->withSubtitles() added

This commit is contained in:
Benjamin Takats
2022-12-17 17:28:46 +01:00
parent ae7426cb1a
commit a932ecc3f0
17 changed files with 234 additions and 173 deletions

View File

@@ -29,6 +29,14 @@ class Course extends Resource
* @var string
*/
public static $title = 'name';
/**
* The columns that should be searched.
* @var array
*/
public static $search = [
'id',
'name',
];
public static function label()
{
@@ -40,15 +48,6 @@ class Course extends Resource
return __('Course');
}
/**
* The columns that should be searched.
* @var array
*/
public static $search = [
'id',
'name',
];
public static function relatableLecturers(NovaRequest $request, $query, Field $field)
{
if ($field instanceof BelongsTo) {
@@ -67,6 +66,11 @@ class Course extends Resource
->toString()));
}
public function subtitle()
{
return __('Erstellt von: :name', ['name' => $this->createdBy->name]);
}
/**
* Get the fields displayed by the resource.
*
@@ -101,7 +105,7 @@ class Course extends Resource
BelongsTo::make(__('Lecturer'), 'lecturer', Lecturer::class)
->searchable()
->help(__('Wähle hier den Dozenten aus, der den Kurs hält. Wenn der Dozent nicht in der Liste ist, dann erstelle ihn zuerst unter "Dozenten".')),
->help(__('Wähle hier den Dozenten aus, der den Kurs hält. Wenn der Dozent nicht in der Liste ist, dann erstelle ihn zuerst unter "Dozenten".'))->withSubtitles(),
SelectPlus::make(__('Categories'), 'categories', Category::class)
->usingIndexLabel('name'),
@@ -114,7 +118,7 @@ class Course extends Resource
return $request->user()
->hasRole('super-admin');
})
->searchable(),
->searchable()->withSubtitles(),
];
}