fede8100
fede8100
FFilament
Created by fede8100 on 5/30/2024 in #❓┊help
How to get $data in Tables\Actions\CreateAction::make()?
In a RelationManager, in the Table, I have this code "return $table ->headerActions([ Tables\Actions\CreateAction::make() ->createAnother(false) ->before(function (RelationManager $livewire, array $data, Tables\Actions\CreateAction $action) { if ($data['total'] > 0) {

} else { Notification::make() ->title('It was canceled, the value can't be zero') ->warning() ->send(); $action->cancel(); } }) ->after(function (RelationManager $livewire, CreditNote $record, array $data) {
}), ])" This code was working since months ago, I used to access the $data array with the data in the form. But since a few updates ago, first $data didn't include the disabled() components, but now it seems that I can't access the $data anymore in the before() method, so I can't control that everything is fine or do an action based on the form data.
5 replies
FFilament
Created by fede8100 on 10/18/2023 in #❓┊help
How to refresh the whole form, with relationmanagers, after an action?
And it works, both for forms and RelationManager, maybe it's good to include in the core
7 replies
FFilament
Created by fede8100 on 10/18/2023 in #❓┊help
How to refresh the whole form, with relationmanagers, after an action?
$livewire->dispatch('refreshForm');
7 replies
FFilament
Created by fede8100 on 10/18/2023 in #❓┊help
How to refresh the whole form, with relationmanagers, after an action?
And
7 replies
FFilament
Created by fede8100 on 10/18/2023 in #❓┊help
How to refresh the whole form, with relationmanagers, after an action?
#[On('refreshForm')] public function refreshForm(): void { if(isset($this->record)) { $this->mount($this->record->id); } else { $this->mount(); } }
7 replies
FFilament
Created by fede8100 on 10/18/2023 in #❓┊help
How to refresh the whole form, with relationmanagers, after an action?
I'm using this
7 replies
FFilament
Created by fede8100 on 8/4/2023 in #❓┊help
How to access the record on a custom page?
Thank you, it works. I tried it before and didn't work, no idea why.
18 replies
FFilament
Created by fede8100 on 8/4/2023 in #❓┊help
How to access the record on a custom page?
I'm using protected function getActions(): array { return [ ViewAction::make(), EditAction::make() ->visible( function () { return !$this->record->isDone(); } ), ]; } as usual
18 replies
FFilament
Created by fede8100 on 8/4/2023 in #❓┊help
How to access the record on a custom page?
namespace Elfeffe\FilamentCerebro\Resources\DeliveryNoteResource\Pages; use Elfeffe\FilamentCerebro\Resources\DeliveryNoteResource; use Filament\Pages\Actions\EditAction; use Filament\Pages\Actions\ViewAction; use Filament\Pages\Concerns\HasFormActions; use Filament\Resources\Pages\Concerns\HasRecordBreadcrumb; use Filament\Resources\Pages\Concerns\InteractsWithRecord; use Filament\Resources\Pages\Page; class ScanDeliveryNote extends Page { use InteractsWithRecord; use HasFormActions; use HasRecordBreadcrumb; protected static string $resource = DeliveryNoteResource::class; protected static string $view = 'filament-cerebro::filament.resources.delivery-note-resource.pages.scan-delivery-note'; public function mount($record): void { static::authorizeResourceAccess(); $this->record = $this->resolveRecord($record); abort_unless(static::getResource()::canView($this->getRecord()), 403); } protected function getActions(): array { return [ ViewAction::make(), EditAction::make() ->visible( function () { return !$this->record->isDone(); } ), ]; } }
18 replies
FFilament
Created by fede8100 on 8/4/2023 in #❓┊help
How to access the record on a custom page?
I click and nothign happens
18 replies
FFilament
Created by fede8100 on 8/4/2023 in #❓┊help
How to access the record on a custom page?
But my action buttons don't work, any idea about how to implement them?
18 replies
FFilament
Created by fede8100 on 8/4/2023 in #❓┊help
How to access the record on a custom page?
public $record; public function mount(Picking $record) { $this->record = $record; }
18 replies
FFilament
Created by fede8100 on 8/4/2023 in #❓┊help
How to access the record on a custom page?
I have added this to my custom page, and seems to work. I don't know if is the best way, but works
18 replies
FFilament
Created by fede8100 on 7/31/2023 in #❓┊help
How to Trim TextInput field before data is saved?
thank you Leandro, but it will disabel the use of dehydrateStateUsing on the field, is there any way to use both in the field and the Macro?
6 replies
FFilament
Created by fede8100 on 4/27/2023 in #❓┊help
I have a morphedByMany multiplies relations
ok, I will
4 replies
FFilament
Created by fede8100 on 4/27/2023 in #❓┊help
I have a morphedByMany multiplies relations
I was asking because I'm not sure if it's a bug or I'm doing something wrong
4 replies
FFilament
Created by fede8100 on 4/6/2023 in #❓┊help
I think lte validator is not working
I had to use ->rules([ function (RelationManager $livewire) { return function (string $attribute, $value, \Closure $fail) use($livewire) { if (round($value, 2) > round($livewire->ownerRecord->grand_total, 2)) { $fail("The amount can't be bigger than the order's amount."); } }; }, ])
5 replies
FFilament
Created by fede8100 on 3/3/2023 in #❓┊help
$get a field on schema stopped working
@Dan Harrin yes, it works now. Thank you!
15 replies
FFilament
Created by fede8100 on 3/3/2023 in #❓┊help
$get a field on schema stopped working
yes, using 2.17.8 fixed the issue for now
15 replies
FFilament
Created by fede8100 on 3/3/2023 in #❓┊help
$get a field on schema stopped working
ok
15 replies