*/ public static $model = \App\Models\CurrencyRate::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 = [ 'id', ]; /** * Determine if the given resource is authorizable. * * @return bool */ public static function authorizable() { if (auth()->user()->isSystemUser()) { return false; } // disables return true; } /** * Determine if the resource should be available for the given request. * * @param \Illuminate\Http\Request $request * @return bool */ public static function authorizedToViewAny(Request $request) { if (auth()->user()->isSystemUser()) { return true; } return false; } /** * Get the fields displayed by the resource. * * @param \Laravel\Nova\Http\Requests\NovaRequest $request * @return array */ public function fields(NovaRequest $request) { return [ ID::make()->sortable(), Select::make(__('Currency from'), 'currency_from') ->displayUsingLabels() ->searchable() ->options(ModelsCurrencyRate::currencies()) ->rules('required') ->fullWidth() ->help('1 möçberi'), Select::make(__('Currency to'), 'currency_to') ->displayUsingLabels() ->searchable() ->options(ModelsCurrencyRate::currencies()) ->rules('required') ->fullWidth(), Text::make('Value', 'value') ->fullWidth() ->help('Bitin däl sanlary "." bilen ýazmaly') ->rules('required', 'numeric'), ]; } /** * Get the cards available for the request. * * @param \Laravel\Nova\Http\Requests\NovaRequest $request * @return array */ public function cards(NovaRequest $request) { return []; } /** * Get the filters available for the resource. * * @param \Laravel\Nova\Http\Requests\NovaRequest $request * @return array */ public function filters(NovaRequest $request) { return []; } /** * Get the lenses available for the resource. * * @param \Laravel\Nova\Http\Requests\NovaRequest $request * @return array */ public function lenses(NovaRequest $request) { return []; } /** * Get the actions available for the resource. * * @param \Laravel\Nova\Http\Requests\NovaRequest $request * @return array */ public function actions(NovaRequest $request) { return []; } }