library items parent_id

This commit is contained in:
Benjamin Takats
2023-01-19 14:59:29 +01:00
parent b1073919df
commit d1d98b6c31
7 changed files with 77 additions and 12 deletions

View File

@@ -26,12 +26,6 @@ class Library extends Resource
* @var string
*/
public static $title = 'name';
public static function label()
{
return __('Library');
}
/**
* The columns that should be searched.
* @var array
@@ -41,6 +35,15 @@ class Library extends Resource
'name',
];
public static $with = [
'createdBy',
];
public static function label()
{
return __('Library');
}
public static function afterCreate(NovaRequest $request, Model $model)
{
\App\Models\User::find(1)
@@ -68,6 +71,10 @@ class Library extends Resource
ID::make()
->sortable(),
BelongsTo::make(__('Parent'), 'parent', __CLASS__)
->searchable()
->nullable(),
Text::make('Name')
->rules('required', 'string'),
@@ -86,7 +93,8 @@ class Library extends Resource
return $request->user()
->hasRole('super-admin');
})
->searchable()->withSubtitles(),
->searchable()
->withSubtitles(),
];
}

View File

@@ -42,6 +42,11 @@ class LibraryItem extends Resource
'name',
];
public static $with = [
'lecturer',
'tags',
];
public static function label()
{
return __('Library Item');