%PDF- %PDF-
Direktori : /var/www/html/camillo/camillo-api-master/app/Nova/ |
Current File : /var/www/html/camillo/camillo-api-master/app/Nova/Subscription.php |
<?php namespace App\Nova; use App\Enums\UsertypeEnum; use Laravel\Nova\Fields\BelongsTo; use Laravel\Nova\Fields\Boolean; use Laravel\Nova\Fields\Date; use Laravel\Nova\Fields\ID; use Illuminate\Http\Request; use Laravel\Nova\Http\Requests\NovaRequest; use Zingazzi\ItalianDateTime\ItalianDateTime as DateTime; class Subscription extends Resource { /** * The model the resource corresponds to. * * @var string */ public static $model = 'App\Models\Subscription'; public static function label() { return __('Subscriptions'); } public static function singularLabel() { return __('Subscription'); } /** * Get the value that should be displayed to represent the resource. * * @return string */ public function title() { return ucfirst($this->minor->name) . " " . ucfirst($this->minor->surname) . " " . $this->start_date->format('d-m-Y') . " " . $this->end_date->format('d-m-Y'); } /** * The columns that should be searched. * * @var array */ public static $search = [ 'id', 'minor_id', 'active' ]; public static $with = [ 'minor' ]; /** * Get the fields displayed by the resource. * * @param \Illuminate\Http\Request $request * @return array */ public function fields(Request $request) { return [ ID::make()->sortable()->canSee(function($request){ return $request->user()->usertype->role === UsertypeEnum::ADMIN; }), BelongsTo::make(__('Minor'), 'minor', Minor::class) ->rules('required') ->sortable() ->searchable(), DateTime::make(__('Start Date'), 'start_date')->format('D-M-Y') ->rules('required') ->sortable(), DateTime::make(__('End date'), 'end_date')->format('D-M-Y') ->rules('required') ->sortable(), Boolean::make(__('Active'), 'active') ]; } /** * 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 []; } }