eazy
eazy
FFilament
Created by slamx_ on 8/17/2023 in #❓┊help
How to load specific model data into Table Builder?
On the User model add a custom accessor for the display name like in the docs: https://laravel.com/docs/10.x/eloquent-mutators#defining-an-accessor propably something like this:
protected function displayName(): Attribute
{
return Attribute::make(
get: fn () => "$this->name $this->last_name",
);
}
protected function displayName(): Attribute
{
return Attribute::make(
get: fn () => "$this->name $this->last_name",
);
}
(or something like that) Then in your textcolumn you can do this:
TextColumn::make('user.display_name')
TextColumn::make('user.display_name')
9 replies
FFilament
Created by slamx_ on 8/17/2023 in #❓┊help
How to load specific model data into Table Builder?
yeah
9 replies
FFilament
Created by slamx_ on 8/17/2023 in #❓┊help
How to load specific model data into Table Builder?
Also if the function is a attribute you can call it the same way with the attribute name
9 replies
FFilament
Created by slamx_ on 8/17/2023 in #❓┊help
How to load specific model data into Table Builder?
Or whatever your relation is called and the name is called on the model
9 replies
FFilament
Created by slamx_ on 8/17/2023 in #❓┊help
How to load specific model data into Table Builder?
TextColumn::make('user.name')
TextColumn::make('user.name')
9 replies
FFilament
Created by eazy on 8/16/2023 in #❓┊help
Dispatch on table row click
Okay I fixed this 🥲 Its actually pretty easy but it took me so long somehow, maybe this function needs to be documented? On your table you add:
->recordAction('sender')
->recordAction('sender')
And then in your livewire component you add:
public function sender()
{
$this->dispatch('openFillAction');
}
public function sender()
{
$this->dispatch('openFillAction');
}
4 replies
FFilament
Created by eazy on 7/27/2023 in #❓┊help
Actions error in Infolist
Thx I was already looking how to do it haha 🙂
15 replies
FFilament
Created by eazy on 7/27/2023 in #❓┊help
Actions error in Infolist
@pboivin I just updated to the newest livewire beta (3.0.7) and it seems to be fixed so I'm closing this issue for now 😄
15 replies
FFilament
Created by eazy on 7/27/2023 in #❓┊help
Actions error in Infolist
Haha okay thanks, I'll wait if you find something 🙂
15 replies
FFilament
Created by eazy on 7/27/2023 in #❓┊help
Actions error in Infolist
Okay, so its not something in my code 😅
15 replies
FFilament
Created by eazy on 7/27/2023 in #❓┊help
Actions error in Infolist
Morning, this still doesn't seem to be working. I was wondering if I'm doing something wrong or if its a bug
15 replies
FFilament
Created by eazy on 7/27/2023 in #❓┊help
Actions error in Infolist
I think it has something to do with the ->requiresConfirmation() modal. Because when I switch from the close_action to the start_configuration it seems to work
15 replies
FFilament
Created by eazy on 7/27/2023 in #❓┊help
Actions error in Infolist
But that also doesn't seem to work
15 replies
FFilament
Created by eazy on 7/27/2023 in #❓┊help
Actions error in Infolist
I've tried replacing the hidden with style display: none; so that the component stays rendered in the background
15 replies
FFilament
Created by eazy on 7/27/2023 in #❓┊help
Actions error in Infolist
This is the error in my console:
Uncaught SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
Uncaught SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
15 replies
FFilament
Created by eazy on 7/27/2023 in #❓┊help
Actions error in Infolist
<?php
public
function machineInfoList(Infolist $infolist): Infolist
{
return $infolist
->record($this->machine)
->schema([
Card::make()
->schema([
TextEntry::make('activeMachineConfiguration.batch.code'),
TextEntry::make('activeMachineConfiguration.started_at'),
Actions::make([
Action::make('close_configuration')
->requiresConfirmation()
->action(function (Machine $record, array $arguments, CloseMachineConfiguration $closeMachineConfiguration, Action $action) {
$closeMachineConfiguration($record->activeMachineConfiguration);
})
]),
])->hidden($infolist->record?->activeMachineConfiguration === null),
Card::make()
->schema([
TextEntry::make('text')
->hiddenLabel()
->size('lg')
->weight('bold'),
Actions::make([
Action::make('start_configuration')
->form([
Select::make('batch')
->label(__('batches.batch'))
->options(Batch::all()->pluck('code', 'id'))
->required(),
])
->action(function (array $data, StartNewConfigurationForMachine $startNewConfigurationForMachine) {
$startNewConfigurationForMachine($data, $this->machine);
})
]),
])->hidden($infolist->record?->activeMachineConfiguration !== null),
]);
}
<?php
public
function machineInfoList(Infolist $infolist): Infolist
{
return $infolist
->record($this->machine)
->schema([
Card::make()
->schema([
TextEntry::make('activeMachineConfiguration.batch.code'),
TextEntry::make('activeMachineConfiguration.started_at'),
Actions::make([
Action::make('close_configuration')
->requiresConfirmation()
->action(function (Machine $record, array $arguments, CloseMachineConfiguration $closeMachineConfiguration, Action $action) {
$closeMachineConfiguration($record->activeMachineConfiguration);
})
]),
])->hidden($infolist->record?->activeMachineConfiguration === null),
Card::make()
->schema([
TextEntry::make('text')
->hiddenLabel()
->size('lg')
->weight('bold'),
Actions::make([
Action::make('start_configuration')
->form([
Select::make('batch')
->label(__('batches.batch'))
->options(Batch::all()->pluck('code', 'id'))
->required(),
])
->action(function (array $data, StartNewConfigurationForMachine $startNewConfigurationForMachine) {
$startNewConfigurationForMachine($data, $this->machine);
})
]),
])->hidden($infolist->record?->activeMachineConfiguration !== null),
]);
}
15 replies
FFilament
Created by eazy on 7/26/2023 in #❓┊help
Open an action from another action
Good night, thanks for your input!
22 replies
FFilament
Created by eazy on 7/26/2023 in #❓┊help
Open an action from another action
Aight, I'm gonna dive into the source to see if I can somehow acces those methods on the InfoListAction or if there are other methods for it
22 replies
FFilament
Created by eazy on 7/26/2023 in #❓┊help
Open an action from another action
Yeah it's really useful to me too and I think to a lot of different users too
22 replies
FFilament
Created by eazy on 7/26/2023 in #❓┊help
Open an action from another action
And place them outside of my infolist
22 replies