mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
new library added
This commit is contained in:
@@ -2,30 +2,28 @@
|
||||
|
||||
namespace App\Nova;
|
||||
|
||||
use Laravel\Nova\Fields\ID;
|
||||
use Illuminate\Http\Request;
|
||||
use Laravel\Nova\Fields\Text;
|
||||
use Laravel\Nova\Fields\HasMany;
|
||||
use Laravel\Nova\Fields\ID;
|
||||
use Laravel\Nova\Fields\MultiSelect;
|
||||
use Laravel\Nova\Fields\Text;
|
||||
|
||||
class Country extends Resource
|
||||
{
|
||||
/**
|
||||
* The model the resource corresponds to.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public static $model = \App\Models\Country::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 = [
|
||||
@@ -37,22 +35,27 @@ class Country extends Resource
|
||||
* Get the fields displayed by the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function fields(Request $request)
|
||||
{
|
||||
return [
|
||||
ID::make()->sortable(),
|
||||
ID::make()
|
||||
->sortable(),
|
||||
|
||||
Text::make('Name')
|
||||
->rules('required', 'string'),
|
||||
|
||||
MultiSelect::make('Languages', 'language_codes')
|
||||
->options(
|
||||
config('languages.languages'),
|
||||
),
|
||||
|
||||
Text::make('Code')
|
||||
->rules('required', 'string'),
|
||||
|
||||
HasMany::make('Cities'),
|
||||
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
@@ -60,6 +63,7 @@ class Country extends Resource
|
||||
* Get the cards available for the request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function cards(Request $request)
|
||||
@@ -71,6 +75,7 @@ class Country extends Resource
|
||||
* Get the filters available for the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function filters(Request $request)
|
||||
@@ -82,6 +87,7 @@ class Country extends Resource
|
||||
* Get the lenses available for the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function lenses(Request $request)
|
||||
@@ -93,6 +99,7 @@ class Country extends Resource
|
||||
* Get the actions available for the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function actions(Request $request)
|
||||
|
||||
@@ -66,7 +66,7 @@ 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),
|
||||
Tags::make('Tags')->type('course')->withLinkToTagResource(Tag::class),
|
||||
|
||||
Text::make('Name')
|
||||
->rules('required', 'string'),
|
||||
|
||||
106
app/Nova/Library.php
Normal file
106
app/Nova/Library.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
namespace App\Nova;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Laravel\Nova\Fields\BelongsToMany;
|
||||
use Laravel\Nova\Fields\ID;
|
||||
use Laravel\Nova\Fields\MultiSelect;
|
||||
use Laravel\Nova\Fields\Text;
|
||||
|
||||
class Library extends Resource
|
||||
{
|
||||
/**
|
||||
* The model the resource corresponds to.
|
||||
* @var string
|
||||
*/
|
||||
public static $model = \App\Models\Library::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',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the fields displayed by the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function fields(Request $request)
|
||||
{
|
||||
return [
|
||||
ID::make()
|
||||
->sortable(),
|
||||
|
||||
Text::make('Name')
|
||||
->rules('required', 'string'),
|
||||
|
||||
MultiSelect::make('Languages', 'language_codes')
|
||||
->options(
|
||||
config('languages.languages'),
|
||||
),
|
||||
|
||||
BelongsToMany::make('Library Items'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the cards available for the request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function cards(Request $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filters available for the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function filters(Request $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the lenses available for the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function lenses(Request $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the actions available for the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function actions(Request $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
146
app/Nova/LibraryItem.php
Normal file
146
app/Nova/LibraryItem.php
Normal file
@@ -0,0 +1,146 @@
|
||||
<?php
|
||||
|
||||
namespace App\Nova;
|
||||
|
||||
use Ebess\AdvancedNovaMediaLibrary\Fields\Files;
|
||||
use Ebess\AdvancedNovaMediaLibrary\Fields\Images;
|
||||
use Illuminate\Http\Request;
|
||||
use Laravel\Nova\Fields\BelongsTo;
|
||||
use Laravel\Nova\Fields\BelongsToMany;
|
||||
use Laravel\Nova\Fields\Code;
|
||||
use Laravel\Nova\Fields\ID;
|
||||
use Laravel\Nova\Fields\Select;
|
||||
use Laravel\Nova\Fields\Text;
|
||||
use Spatie\TagsField\Tags;
|
||||
|
||||
class LibraryItem extends Resource
|
||||
{
|
||||
/**
|
||||
* The model the resource corresponds to.
|
||||
* @var string
|
||||
*/
|
||||
public static $model = \App\Models\LibraryItem::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',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the fields displayed by the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function fields(Request $request)
|
||||
{
|
||||
return [
|
||||
ID::make()
|
||||
->sortable(),
|
||||
|
||||
Images::make('Main picture', 'main')
|
||||
->conversionOnIndexView('thumb'),
|
||||
|
||||
Images::make('Images', 'images')
|
||||
->conversionOnIndexView('thumb')
|
||||
->help('Lade hier Bilder hoch, um sie eventuell später in der Markdown Description einzufügen. Du musst vorher aber Speichern.'),
|
||||
|
||||
Files::make('Downloadable File', 'single_file')
|
||||
->help('Für neue Datei-Typen bitte bei den Admins melden. (Derzeit: PDF)'),
|
||||
|
||||
Select::make('Language Code', 'language_code')
|
||||
->options(
|
||||
config('languages.languages')
|
||||
)
|
||||
->rules('required', 'string'),
|
||||
|
||||
Tags::make('Tags')
|
||||
->type('library_item')
|
||||
->withLinkToTagResource(Tag::class),
|
||||
|
||||
Text::make('Name')
|
||||
->rules('required', 'string'),
|
||||
|
||||
Select::make('Type')
|
||||
->options(
|
||||
[
|
||||
'book' => 'book',
|
||||
'blog_article' => 'blog_article',
|
||||
'markdown_article' => 'markdown_article',
|
||||
'youtube_video' => 'youtube_video',
|
||||
'vimeo_video' => 'vimeo_video',
|
||||
'downloadable_file' => 'downloadable_file',
|
||||
]
|
||||
)
|
||||
->rules('required', 'string'),
|
||||
|
||||
Code::make('Value')
|
||||
->rules('required', 'string')
|
||||
->help('Hier bitte die URL zum Video einfügen, oder den Link zum Blog-Artikel, oder den Link zum Buch, oder das Markdown selbst einfügen.'),
|
||||
|
||||
BelongsTo::make('Lecturer'),
|
||||
|
||||
BelongsToMany::make('Library'),
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the cards available for the request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function cards(Request $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filters available for the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function filters(Request $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the lenses available for the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function lenses(Request $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the actions available for the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function actions(Request $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,8 @@ class Tag extends Resource
|
||||
|
||||
Select::make('Type')
|
||||
->options([
|
||||
'search' => 'search',
|
||||
'course' => 'course',
|
||||
'library_item' => 'library_item',
|
||||
]),
|
||||
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user