File: /home/hasdeuac-119/has.deu.ac.kr/app/Nova/Central/User.php
<?php
namespace App\Nova\Central;
use App\Models\Central\User as UserModel;
use App\Nova\Permission;
use App\Nova\Resource;
use App\Nova\Role;
use Laravel\Nova\Fields\Gravatar;
use Laravel\Nova\Fields\HasMany;
use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\MorphToMany;
use Laravel\Nova\Fields\Password;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Http\Requests\NovaRequest;
class User extends Resource
{
/**
* The model the resource corresponds to.
*
* @var string
*/
public static $model = UserModel::class;
/**
* The single value that should be used to represent the resource when being displayed.
*
* @var string
*/
public static $title = 'name';
/**
* The columns that should be searched.
*
* @var array
*/
public static $search = [
'id', 'name', 'email',
];
/**
* Get the logical group associated with the resource.
*
* @return string
*/
public static function group(): string
{
return __('Manage Users');
}
public static function label(): string
{
return __('Manage Users');
}
/**
* Get the fields displayed by the resource.
*/
public function fields(NovaRequest $request): array
{
$fields = [
ID::make()->sortable(),
Gravatar::make(__('Avatar'),'avatar')->maxWidth(50),
Text::make(__('Name'),'name')
->sortable()
->rules('required', 'max:255'),
Text::make(__('Email'),'email')
->sortable()
->rules('required', 'email', 'max:254')
->creationRules('unique:admins,email')
->updateRules('unique:admins,email,{{resourceId}}'),
Password::make(__('Password'),'password')
->onlyOnForms()
->creationRules('required', 'string', 'min:8')
->updateRules('nullable', 'string', 'min:8'),
];
if(config('amuz.use_tenant_preset',false) === true){
$fields[] = HasMany::make('Tenants','tenants',Tenant::class);
}
return $fields;
}
/**
* Get the cards available for the request.
*/
public function cards(NovaRequest $request): array
{
return [];
}
/**
* Get the filters available for the resource.
*/
public function filters(NovaRequest $request): array
{
return [];
}
/**
* Get the lenses available for the resource.
*/
public function lenses(NovaRequest $request): array
{
return [];
}
/**
* Get the actions available for the resource.
*/
public function actions(NovaRequest $request): array
{
return [];
}
}