*/ public static $model = \App\Models\Contest::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 = [ 'name', ]; public static function indexQuery(NovaRequest $request, $query): \Illuminate\Database\Eloquent\Builder { return $query->where('fin', '>=', now())->where('participated', '!=', true); } /** * Get the fields displayed by the resource. * * @param \Laravel\Nova\Http\Requests\NovaRequest $request * @return array */ public function fields(NovaRequest $request) { return [ Boolean::make('Participate', 'participated'), Text::make('Name')->readonly(), Text::make('Screen')->readonly(), Text::make('Description')->readonly(), Text::make('Nb Like', 'nblike')->readonly(), Text::make('Nb Reply', 'nbreply')->readonly(), Image::make('Image', 'picture') ->thumbnail(function ($value) { return $value; }) ->preview(function ($value) { return $value; }) ->disableDownload(), URL::make('URL')->readonly(), Date::make('Fin')->sortable(), Text::make('Tweet ID', 'tweetid')->hideFromIndex()->readonly(), Text::make('Nb Tweet', 'nbtweet')->readonly(), ]; } /** * 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 [ Participer::make(), ]; } }