%PDF- %PDF-
| Direktori : /var/www/tsi-crm/app/Nova/ |
| Current File : /var/www/tsi-crm/app/Nova/Accounts.php |
<?php
namespace App\Nova;
use Illuminate\Http\Request;
use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\Select;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Panel;
use Laravel\Nova\Http\Requests\NovaRequest;
use App\Models\Categorie;
use Laravel\Nova\Fields\Email;
class Accounts extends Resource
{
/**
* The model the resource corresponds to.
*
* @var class-string<\App\Models\Accounts>
*/
public static $model = \App\Models\Accounts::class;
/**
* 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',
'name'
];
/**
* Get the fields displayed by the resource.
*
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
* @return array
*/
public function fields(NovaRequest $request)
{
return [
ID::make()->sortable(),
Text::make('Name', 'name')->sortable()->rules('required'),
Text::make('Partita iva', 'lbl_partita_iva')->hideFromIndex(),
Select::make('Stato', 'lbl_stato')->options([
'Attivo' => 'Attivo',
'Sospesa' => 'Sospesa',
'Fallita' => 'Fallita',
]), //enum
Select::make('Categoria', 'idCategoria')->options(
Categorie::all()->pluck('name', 'id')
)->displayUsingLabels(),
Text::make('Assigned to', 'assignedTo'),
Select::make('Type', 'type')->options([
'Customer' => 'Customer',
'Other' => 'Other',
'Fornitore' => 'Fornitore',
]),
Panel::make('Contact Information', $this->contactFields()),
Panel::make('Address Information', $this->addressFields()),
];
}
protected function contactFields()
{
return [
Text::make('Website', 'website')->hideFromIndex(),
Email::make('Email Address', 'emailAddress'),
Text::make('Office Phone', 'officePhone'),
];
}
protected function addressFields()
{
return [
Text::make('Street', 'street')->hideFromIndex(),
Text::make('City', 'city'),
Text::make('State', 'state')->hideFromIndex(),
Text::make('Postal Code', 'postalCode')->hideFromIndex(),
Text::make('Country', 'country')->hideFromIndex(),
];
}
/**
* Get the cards available for the request.
*
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
* @return array
*/
public function cards(NovaRequest $request)
{
return [];
}
/**
* Get the filters available for the resource.
*
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
* @return array
*/
public function filters(NovaRequest $request)
{
return [];
}
/**
* Get the lenses available for the resource.
*
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
* @return array
*/
public function lenses(NovaRequest $request)
{
return [];
}
/**
* Get the actions available for the resource.
*
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
* @return array
*/
public function actions(NovaRequest $request)
{
return [];
}
}