Select::make('suivi_user_maintenance') ->relationship('suivipar', 'name', function ($query, $state) { $query->where(fn ($q) => $q->where('statut', 1) ->with('role') ->whereHas('role', function ($q) { $q->whereIn('name', ['S', 'RS', 'AF', 'AT']))->when($state, fn ($q, $value) => $q->orWhere('id', $value)); }) ->orderBy('name'); } )
getHeaderActions()
CreateAction
public function handle(array $company, string $path = ''): Company{ $validated = Validator::make($company, [ $path.'name' => ['required', 'max:255'], $path.'nip' => ['required', new NipRule(), 'unique:companies,nip'], $path.'regon' => ['required', new RegonRule(), 'unique:companies,regon'], $path.'krs' => ['max:10', 'nullable'], $path.'website' => ['url', 'nullable'], ])->validate(); return Company::create($validated);}
public function submit(\App\Actions\CreateCompany $createCompany): RedirectResponse|Redirector{ $createCompany->handle($this->company, 'company.'); return redirect()->route('companies.index');}
UserResource::getSchema()
TextInput::make('total_of_days') ->disabled() ->formatStateUsing(fn(\Closure $get) => Carbon::parse($get('start_date'))->diffInDays(Carbon::parse($get('end_date'))))->dehydrateUsing(fn(\Closure $get) => Carbon::parse($get('start_date'))->diffInDays(Carbon::parse($get('end_date')))) ->dehydrated(true) ->required(),
'primary' => Color::hex('#694398'),
isReadOnly()
Tables\Columns\TextColumn::make('price')->money('eur', 100)
TextColumn::make('field')->url('your url')
Fieldset::make('Bed Types')->schema([Grid::make(5)->schema([]), Grid::make(5)->schema([])])