Arjen
Arjen
FFilament
Created by Arjen on 1/25/2024 in #❓┊help
Table column loses data when sorting by relationship
I've got it working by using the following code:
Tables\Columns\TextColumn::make('booking_date')
->label('Datum')
->date('d-m-Y')
->sortable(
query: fn ($query, $direction) => $query
->join('dayparts', function ($join) {
$join->on('dayparts.booking_id', '=', 'bookings.id')
->on('dayparts.id', DB::raw("(SELECT min(id) FROM dayparts WHERE dayparts.booking_id = bookings.id)"));
})
->orderBy('date', $direction)
),
Tables\Columns\TextColumn::make('booking_date')
->label('Datum')
->date('d-m-Y')
->sortable(
query: fn ($query, $direction) => $query
->join('dayparts', function ($join) {
$join->on('dayparts.booking_id', '=', 'bookings.id')
->on('dayparts.id', DB::raw("(SELECT min(id) FROM dayparts WHERE dayparts.booking_id = bookings.id)"));
})
->orderBy('date', $direction)
),
Booking model:
public function getBookingDateAttribute()
{
return data_get($this, 'date', data_get($this->dayparts, '0.date', null));
}
public function getBookingDateAttribute()
{
return data_get($this, 'date', data_get($this->dayparts, '0.date', null));
}
I'm curious to know if this is an acceptable solution or if there are better solutions for this problem.
3 replies
FFilament
Created by Arjen on 12/1/2023 in #❓┊help
Convert Filament::registerScripts
@giuseppemastrodonato Sadly no.
5 replies
FFilament
Created by Arjen on 10/11/2023 in #❓┊help
Setting searchable select field to null not working
That didn't work either. When I click the x in the select field, it shows nothing. With null it at least shows the placeholder. But I shouldn't have to press the x.
4 replies
FFilament
Created by Arjen on 9/30/2023 in #❓┊help
Best way to include script
Ooh nice one, thanks!
5 replies
FFilament
Created by Arjen on 9/30/2023 in #❓┊help
Best way to include script
... so I'm not sure if this is the correct way to include scripts that I want to have loaded on all pages
5 replies
FFilament
Created by Arjen on 3/9/2023 in #❓┊help
Error when prefilling from query string in resource with persistTabInQueryString enabled
Sure!
11 replies
FFilament
Created by Arjen on 3/9/2023 in #❓┊help
Error when prefilling from query string in resource with persistTabInQueryString enabled
Tried it that way but it's still not working. It seems like a bug in Filament. @Dan Harrin Any thoughts about it? Should I make an issue in the github repo?
11 replies
FFilament
Created by Arjen on 3/9/2023 in #❓┊help
Error when prefilling from query string in resource with persistTabInQueryString enabled
I don't understand what validation rules have to with my problem. My query string gets validated fine, but I get a Typed property Filament\Forms\Components\Component::$container must not be accessed before initialization when have the following enabled: ->persistTabInQueryString('tab')
11 replies
FFilament
Created by Arjen on 3/9/2023 in #❓┊help
Error when prefilling from query string in resource with persistTabInQueryString enabled
Not sure what you mean by rules()
11 replies
FFilament
Created by Arjen on 3/9/2023 in #❓┊help
Error when prefilling from query string in resource with persistTabInQueryString enabled
And the code for the tabs:
Forms\Components\Tabs::make('Tabs')
->id('tabs')
->persistTabInQueryString('tab') // <-- culprit
->tabs([
Forms\Components\Tabs\Tab::make('Documenten')
->schema([
Forms\Components\Toggle::make('has_documents')
->label('Documenten?')
->inline(false)
->default(false)
->reactive(),
Forms\Components\Repeater::make('documents')
->label('Documenten')
->relationship()
->schema([
Forms\Components\Radio::make('type')
Forms\Components\FileUpload::make('file')
->label('Bestand')
->directory('documents')
->preserveFilenames()
->removeUploadedFileButtonPosition('right')
->required(),
])
->visible(fn (\Closure $get) => $get('has_documents'),
]),
Forms\Components\Tabs\Tab::make('Evenement')
->schema([
Forms\Components\Toggle::make('has_event')
->label('Evenement?')
->inline(false)
->default(false)
->reactive(),
Forms\Components\TextInput::make('event_start')
->label('Start')
->type('datetime-local')
->required()
->columns(2)
->visible(fn (\Closure $get) => $get('has_event')),
Forms\Components\TextInput::make('event_end')
->label('Eind')
->type('datetime-local')
->columns(2)
->visible(fn (\Closure $get) => $get('has_event')),
]),
]),
Forms\Components\Tabs::make('Tabs')
->id('tabs')
->persistTabInQueryString('tab') // <-- culprit
->tabs([
Forms\Components\Tabs\Tab::make('Documenten')
->schema([
Forms\Components\Toggle::make('has_documents')
->label('Documenten?')
->inline(false)
->default(false)
->reactive(),
Forms\Components\Repeater::make('documents')
->label('Documenten')
->relationship()
->schema([
Forms\Components\Radio::make('type')
Forms\Components\FileUpload::make('file')
->label('Bestand')
->directory('documents')
->preserveFilenames()
->removeUploadedFileButtonPosition('right')
->required(),
])
->visible(fn (\Closure $get) => $get('has_documents'),
]),
Forms\Components\Tabs\Tab::make('Evenement')
->schema([
Forms\Components\Toggle::make('has_event')
->label('Evenement?')
->inline(false)
->default(false)
->reactive(),
Forms\Components\TextInput::make('event_start')
->label('Start')
->type('datetime-local')
->required()
->columns(2)
->visible(fn (\Closure $get) => $get('has_event')),
Forms\Components\TextInput::make('event_end')
->label('Eind')
->type('datetime-local')
->columns(2)
->visible(fn (\Closure $get) => $get('has_event')),
]),
]),
11 replies
FFilament
Created by Arjen on 3/8/2023 in #❓┊help
Page::$reportValidationErrorUsing dispatchBrowserEvent
Can't use $this in that context, this is placed in the boot() method of the AppServiceProvider.
3 replies