File: /home/eslinced-103/brise-edu.or.kr/app/Nova/Central/User.php
<?php
namespace App\Nova\Central;
use AmuzPackages\EslincEdu\Resources\University;
use App\Models\Central\User as UserModel;
use App\Nova\Resource;
use Illuminate\Http\Request;
use Laravel\Nova\Fields\BelongsTo;
use Laravel\Nova\Fields\Gravatar;
use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\Password;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Http\Requests\NovaRequest;
use Vyuldashev\NovaPermission\PermissionBooleanGroup;
use Vyuldashev\NovaPermission\RoleBooleanGroup;
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', 'company_name','username','phone'
];
/**
* 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
{
return [
ID::make()->sortable(),
Gravatar::make()->maxWidth(50),
Text::make('Name')
->sortable()
->rules('required', 'max:255'),
Text::make('Email')
->sortable()
->rules('required', 'email', 'max:254')
->creationRules('unique:users,email')
->updateRules('unique:users,email,{{resourceId}}'),
Password::make('Password')
->onlyOnForms()
->creationRules('required', 'string', 'min:8')
->updateRules('nullable', 'string', 'min:8'),
Text::make('소속','company_name')->sortable(),
Text::make('직급','company_grade')->sortable(),
Text::make('사용자명','username')->sortable(),
Text::make('휴대전화','phone'),
BelongsTo::make('추천한 대학','university', University::class)->sortable()
// RoleBooleanGroup::make('Roles'),
// PermissionBooleanGroup::make('Permissions'),
];
}
/**
* 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 [];
}
}