%PDF- %PDF-
Direktori : /home/forge/api-takeaseat.eco-n-tech.co.uk/app/Nova/ |
Current File : //home/forge/api-takeaseat.eco-n-tech.co.uk/app/Nova/Availability.php |
<?php namespace App\Nova; use Illuminate\Http\Request; use Laravel\Nova\Fields\ID; use Laravel\Nova\Fields\BelongsTo; use Laravel\Nova\Fields\DateTime; use Laravel\Nova\Http\Requests\NovaRequest; class Availability extends Resource { /** * The model the resource corresponds to. * * @var string */ public static $model = \App\Models\Availability::class; /** * The logical group associated with the resource. * * @var string */ public static $group = 'Therapists'; /** * The relationships that should be eager loaded on index queries. * * @var array */ public static $with = ['therapist', 'sessions', 'address']; /** * Get the value that should be displayed to represent the resource. * * @return string */ public function title() { return $this->available_from->format('d/m/Y h:i'). ' - '.$this->available_to->format('H:i'); } /** * Get the search result subtitle for the resource. * * @return string */ public function subtitle() { return "Therapist: {$this->therapist->user->full_name}"; } /** * The columns that should be searched. * * @var array */ public static $search = [ 'id', 'available_from', 'available_to' ]; /** * Get the searchable columns for the resource. * * @return array */ public static function searchableRelations(): array { return [ 'therapist.user' => ['first_name', 'last_name'], 'address' => ['address', 'town_city', 'postcode', 'lat', 'lng'] ]; } /** * Get the searchable columns for the resource. * * @return array */ public static function globallySearchableRelations(): array { return [ 'therapist.user' => ['first_name', 'last_name'], 'address' => ['address', 'town_city', 'postcode', 'lat', 'lng'] ]; } /** * 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('Therapist')->sortable(), DateTime::make('Available From')->sortable(), DateTime::make('Available To')->sortable(), BelongsTo::make('Address')->sortable(), ]; } /** * 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 []; } }