bega updates
This commit is contained in:
134
app/Nova/Resources/CMS/Media/Story.php
Normal file
134
app/Nova/Resources/CMS/Media/Story.php
Normal file
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
|
||||
namespace App\Nova\Resources\CMS\Media;
|
||||
|
||||
use App\Models\CMS\Media\Story as StoryModel;
|
||||
use App\Nova\Filters\VisableFilter;
|
||||
use App\Nova\Resource;
|
||||
use Ebess\AdvancedNovaMediaLibrary\Fields\Images;
|
||||
use Laravel\Nova\Fields\DateTime;
|
||||
use Laravel\Nova\Fields\ID;
|
||||
use Laravel\Nova\Fields\Text;
|
||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||
use Laravel\Nova\Panel;
|
||||
use Outl1ne\NovaSortable\Traits\HasSortableRows;
|
||||
use Trin4ik\NovaSwitcher\NovaSwitcher;
|
||||
|
||||
class Story extends Resource
|
||||
{
|
||||
/**
|
||||
* Sortable behavior.
|
||||
*/
|
||||
use HasSortableRows;
|
||||
|
||||
/**
|
||||
* The model the resource corresponds to.
|
||||
*
|
||||
* @var class-string<StoryModel>
|
||||
*/
|
||||
public static $model = StoryModel::class;
|
||||
|
||||
/**
|
||||
* The single value that should be used to represent the resource when being displayed.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public static $title = 'id';
|
||||
|
||||
/**
|
||||
* The columns that should be searched.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $search = [
|
||||
'title',
|
||||
];
|
||||
|
||||
/**
|
||||
* The relationships that should be eager loaded on index queries.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $with = ['media'];
|
||||
|
||||
/**
|
||||
* Get the displayable label of the resource.
|
||||
*/
|
||||
public static function label(): string
|
||||
{
|
||||
return __('Stories');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the displayable singular label of the resource.
|
||||
*/
|
||||
public static function singularLabel(): string
|
||||
{
|
||||
return __('Story');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fields displayed by the resource.
|
||||
*/
|
||||
public function fields(NovaRequest $request): array
|
||||
{
|
||||
return [
|
||||
new Panel(__('Basic information'), [
|
||||
ID::make()->sortable(),
|
||||
|
||||
Images::make(__('Photo'), 'photo')
|
||||
->conversionOnIndexView('thumb200x200')
|
||||
->rules('required')
|
||||
->required(),
|
||||
|
||||
Text::make(__('Title'), 'title')
|
||||
->rules('required')
|
||||
->translatable(),
|
||||
|
||||
DateTime::make(__('Expires at'), 'expires_at')
|
||||
->default(now()->addDay())
|
||||
->nullable()
|
||||
->rules('nullable', 'date')
|
||||
->help(__('Default is 24 hours from creation. Set a specific date and hour to control when the story disappears from the mobile app.')),
|
||||
|
||||
NovaSwitcher::make(__('Visible'), 'is_visible')
|
||||
->default(true)
|
||||
->sortable(),
|
||||
]),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 [
|
||||
new VisableFilter(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user