Categories
Laravel

How to Laravel Nova? Postgres

Create Resource

 php artisan nova:resource DirectMailing

Create Model

 php artisan make:model DirectMailing -m

Postgres

How to deal multiple schema ?

Connection variable is critical

protected $connection = 'pgsql-api';

How to deal with Schema and uuids ?

file location : app/LoyaltyLevels.php

class LoyaltyLevels extends Model
{
    //
    protected $connection = 'pgsql-api';
    protected $table = 'api.loyalty_levels';
    /**
     * The primary key associated with the table.
     *
     * @var string
     */
    protected $primaryKey = 'loyalty_level_uuid';
    protected $keyType = 'string';
}

File location app/Nova/LoyaltyLevels.php

 public function fields(Request $request)
    {
        return [
            Text::make('loyalty_level')->sortable(),
            Text::make('loyalty_level_description')->sortable(),
        ];
    }

Leave a Reply