Quick resource + model generator
php artisan nova:resource Businesses
php artisan make:model Businesses
Model Example : Thetable
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Thetable extends Model
{
protected $connection = 'pgsql-api';
protected $table = 'mapi_admin_tool.THETABLE';
protected $primaryKey = 'id';
protected $dateFormat = 'Y-m-d H:i:sO';
public function __construct(array $attributes = [])
{
parent::__construct($attributes);
}
protected $dates = [
'created_at',
'updated_at',
'deleted_at'
];
}
Nova Resource Example
<?php
namespace App\Nova;
use Illuminate\Http\Request;
use Laravel\Nova\Fields\Date;
use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Http\Requests\NovaRequest;
class Thetable extends Resource
{
/**
* The model the resource corresponds to.
*
* @var string
*/
public static $model = 'App\M2TrackFileSubmissionToWindsurfer';
/**
* The single value that should be used to represent the resource when being displayed.
*
* @var string
*/
public static $title = 'id';
/**
* The columns that should be searched.
*
* @var array
*/
public static $search = [
'id',
];
/**
* Get the fields displayed by the resource.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function fields(Request $request)
{
return [
ID::make('id')->sortable(),
Text::make('file_uuid')->sortable(),
Text::make('set_uuid')->sortable(),
Text::make('windsurfer_job_id')->sortable(),
Text::make('cust_filename')->sortable(),
Text::make('artwork_info')->sortable(),
Date::make('created_at')->sortable(),
Date::make('update_at')->sortable(),
];
}