mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
add tags
This commit is contained in:
@@ -11,6 +11,7 @@ use Laravel\Nova\Fields\ID;
|
||||
use Laravel\Nova\Fields\Markdown;
|
||||
use Laravel\Nova\Fields\Text;
|
||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||
use Spatie\TagsField\Tags;
|
||||
use ZiffMedia\NovaSelectPlus\SelectPlus;
|
||||
|
||||
class Course extends Resource
|
||||
@@ -65,6 +66,8 @@ class Course extends Resource
|
||||
->conversionOnIndexView('thumb')
|
||||
->help('Lade hier Bilder hoch, um sie eventuell später in der Markdown Description einzufügen. Du musst vorher aber Speichern.'),
|
||||
|
||||
Tags::make('Tags')->type('search')->withLinkToTagResource(Tag::class),
|
||||
|
||||
Text::make('Name')
|
||||
->rules('required', 'string'),
|
||||
|
||||
|
||||
32
app/Nova/Tag.php
Normal file
32
app/Nova/Tag.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Nova;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Laravel\Nova\Fields\Select;
|
||||
use Laravel\Nova\Fields\Text;
|
||||
|
||||
class Tag extends Resource
|
||||
{
|
||||
public static $model = \App\Models\Tag::class;
|
||||
|
||||
public static $title = 'name';
|
||||
|
||||
public static $search = [
|
||||
'name',
|
||||
];
|
||||
|
||||
public function fields(Request $request)
|
||||
{
|
||||
return [
|
||||
Text::make('Name')->sortable(),
|
||||
|
||||
Text::make('Translation')->sortable(),
|
||||
|
||||
Select::make('Type')->options([
|
||||
'search' => 'search',
|
||||
]),
|
||||
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user