title)){ return $this->id; } return $this->title; } /** * The columns that should be searched. * * @var array */ public static $search = [ 'id', 'title', 'body' ]; public static function indexQuery(NovaRequest $request, $query) { return $query->where('status', 1)->where('is_ads', false); } /** * Get the fields displayed by the resource. * * @param \Illuminate\Http\Request $request * @return array */ public function fields(Request $request) { return [ ID::make(__('ID'), 'id')->sortable(), BelongsTo::make('Creator', 'user', 'App\Nova\User') ->onlyOnIndex(), Files::make('Media Preview', 'preview')->readonly(), Files::make('Media', 'common')->readonly(), Files::make('Media Paid', 'paid')->readonly(), Text::make('Title'), Text::make('Slug')->readonly(), Select::make('Type')->options([ 'images' => 'Изображение', 'musics' => 'Аудио', 'videos' => 'Видео', ])->readonly()->displayUsingLabels(), Text::make('Price')->readonly(), Textarea::make('Body')->alwaysShow()->hideFromIndex(), HasMany::make('Comments'), HasMany::make('Complaints'), DateTime::make('Created At')->format('DD MMM YYYY'), DateTime::make('Updated At')->hideFromIndex(), // Select::make('Status')->options([ // (string) StatusEnum::PENDING() => 'pending', // (string) StatusEnum::APPROVED() => 'approved', // (string) StatusEnum::BANNED() => 'banned', // (string) StatusEnum::EDITABLE() => 'editable', // ])->displayUsingLabels()->onlyOnIndex()->sortable(), // Select::make('Status')->options([ // (string) StatusEnum::APPROVED() => 'approved', // (string) StatusEnum::BANNED() => 'banned', // ])->displayUsingLabels()->hideFromIndex()->hideWhenCreating(), // Textarea::make('Status Note')->hideWhenCreating(), ]; } /** * 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 []; } }