ChesterS
ChesterS
FFilament
Created by ChesterS on 9/17/2024 in #❓┊help
Register Filepond Plugin
Thanks, I'll have a look 🙇‍♂️
15 replies
FFilament
Created by ChesterS on 9/17/2024 in #❓┊help
Register Filepond Plugin
What do you mean? Can you share it?
15 replies
FFilament
Created by ChesterS on 9/17/2024 in #❓┊help
Register Filepond Plugin
I wanted to enable the plugin that allows renaming of file uploads (https://pqina.nl/filepond/docs/api/plugins/file-rename/)
15 replies
FFilament
Created by jjo63 on 1/1/2025 in #❓┊help
Livewire / Custom Page issue / skipRender not functioning?
What exactly are you trying to achieve here? Do you want to just change the color of the icon or do you want to persist something in the database? If all you want is to change the color of the icon, you don't need any Livewire calls, just use JS. My guess is that you want to save the user's favourites in the DB. In that case, I would double-check the rest of the code because it looks like there are some bugs somewhere. 1) Make sure the original state is populated correctly in your template 2) Make sure your changes are saved in the database as expected With the code samples you provided, we can't help you much. Either way, you can try the #[Renderless] attribute on that method, see if that works.
4 replies
FFilament
Created by ChesterS on 9/17/2024 in #❓┊help
Register Filepond Plugin
Please let me know if you figure it out 🙇‍♂️
15 replies
FFilament
Created by ChesterS on 9/17/2024 in #❓┊help
Register Filepond Plugin
No sorry I kinda gave up because I didn't like any of the possible solutions I could think off 😦
15 replies
FFilament
Created by ericmp on 12/8/2024 in #❓┊help
Cant make reverb to work inside admin panel
Ignore the fact that say 'pusher' - it's just a similar protocol Is the key key in your env correct? Also, can you share your reverb config? Is this error locally or in production?
7 replies
FFilament
Created by ChesterS on 12/5/2024 in #❓┊help
Form trying to update a field that is not in the form
Thank you for your time 🙇‍♂️
17 replies
FFilament
Created by ChesterS on 12/5/2024 in #❓┊help
Form trying to update a field that is not in the form
Ok I fixed it by changing the cast attribute. I thought Filament only tries to update fields that you set in the form :/
17 replies
FFilament
Created by ChesterS on 12/5/2024 in #❓┊help
Form trying to update a field that is not in the form
actually nvm...Here is the data
"id" => 1
"uuid" => "95de666b-2d6a-45e5-a1a0-71903007af0e"
"description" => "asdfasdf"
"is_managed" => true
"deleted_at" => null
"created_at" => "2024-03-08T10:33:59.000000Z"
"updated_at" => "2024-12-05T19:42:43.000000Z"
"alert" => null
]
"id" => 1
"uuid" => "95de666b-2d6a-45e5-a1a0-71903007af0e"
"description" => "asdfasdf"
"is_managed" => true
"deleted_at" => null
"created_at" => "2024-03-08T10:33:59.000000Z"
"updated_at" => "2024-12-05T19:42:43.000000Z"
"alert" => null
]
17 replies
FFilament
Created by ChesterS on 12/5/2024 in #❓┊help
Form trying to update a field that is not in the form
Yeap
class EditProperty extends EditRecord
{
protected static string $resource = PropertyResource::class;

protected function getHeaderActions(): array
{
return [
Actions\DeleteAction::make(),
];
}

protected function mutateFormDataBeforeSave(array $data): array
{
dd($data);
}

protected function beforeSave(): void
{
dd('save', $this->data);
}
}
class EditProperty extends EditRecord
{
protected static string $resource = PropertyResource::class;

protected function getHeaderActions(): array
{
return [
Actions\DeleteAction::make(),
];
}

protected function mutateFormDataBeforeSave(array $data): array
{
dd($data);
}

protected function beforeSave(): void
{
dd('save', $this->data);
}
}
17 replies
FFilament
Created by ChesterS on 12/5/2024 in #❓┊help
Form trying to update a field that is not in the form
I tried these
protected function mutateFormDataBeforeSave(array $data): array
{
dd($data);
}

protected function beforeSave(): void
{
dd($this->data);
}
protected function mutateFormDataBeforeSave(array $data): array
{
dd($data);
}

protected function beforeSave(): void
{
dd($this->data);
}
but nothing happens. Is it because the form is in the resource?
17 replies
FFilament
Created by ChesterS on 12/5/2024 in #❓┊help
Form trying to update a field that is not in the form
Yeap I'll try both sec
17 replies
FFilament
Created by ChesterS on 12/5/2024 in #❓┊help
Form trying to update a field that is not in the form
Hmm this is an edit form
17 replies
FFilament
Created by ChesterS on 12/5/2024 in #❓┊help
Form trying to update a field that is not in the form
I'm ... still not sure what you mean? :/ I don't use it anywhere in the form - it's a field that exists on the model I just created a trait for it because I also use the same login logic in other models
17 replies
FFilament
Created by ChesterS on 12/5/2024 in #❓┊help
Form trying to update a field that is not in the form
What do you mean?
17 replies
FFilament
Created by ChesterS on 12/5/2024 in #❓┊help
Form trying to update a field that is not in the form
There's not much to share TBH. Here is the schema
public static function form(Form $form): Form
{
return $form
->schema([
Textarea::make('description'),
Toggle::make('is_active'),
]);
}
public static function form(Form $form): Form
{
return $form
->schema([
Textarea::make('description'),
Toggle::make('is_active'),
]);
}
But I think the issue might be related to the alert field. It's included through a trait like this
trait HasAlert
{
public function initializeHasAlert()
{
$this->mergeCasts([
'alert' => Alert::class,
]);

$this->mergeFillable([
'alert',
]);
}
}
trait HasAlert
{
public function initializeHasAlert()
{
$this->mergeCasts([
'alert' => Alert::class,
]);

$this->mergeFillable([
'alert',
]);
}
}
I still don't understand why it would try to save it if it's not in the form or if there's a workaround for it
17 replies
FFilament
Created by Matthew on 11/19/2024 in #❓┊help
Use HeaderAction to upload file in FileUpload.
Not sure what you're trying to do, but you can use the saveUploadedFileUsing method.
Actions\Action::make('test')
->form([
FileUpload::make('files')
->saveUploadedFileUsing(fn ($file) => dd($file))
])
Actions\Action::make('test')
->form([
FileUpload::make('files')
->saveUploadedFileUsing(fn ($file) => dd($file))
])
If you want to handle the file creation manually, you can set storeFiles(false) in the fileupload, and then get the raw state and do w/e you want
Actions\Action::make('test')
->form([
FileUpload::make('files')
->storeFiles(false)
])
->action(function(Form $form) {
dd($form->getRawState());
}),
Actions\Action::make('test')
->form([
FileUpload::make('files')
->storeFiles(false)
])
->action(function(Form $form) {
dd($form->getRawState());
}),
hope it helps
4 replies
FFilament
Created by Tudor on 11/11/2024 in #❓┊help
canAccess function generate a lot of duplicate queries
It didn't duplicate for every user, it did for every event. In any case, it doesn't matter since you found a workaround 👍
5 replies
FFilament
Created by Tudor on 11/11/2024 in #❓┊help
canAccess function generate a lot of duplicate queries
Is this in a table or a list of sorts? You might need to refactor how you check what people can see in that page - instead of checking if they have access to each event one-by-one, maybe only show the events they do have access to and skip the canAccess() check entirely? Or maybe eager-load the event contestants and use a different policy?
Depends o what you're trying to achieve. Also, your query can be improved.
public static function canAccess(): bool
{
return Filament::getTenant()->eventContestants()->where('user_id', auth()->id())->exists();
}
public static function canAccess(): bool
{
return Filament::getTenant()->eventContestants()->where('user_id', auth()->id())->exists();
}
Some other improvements can probably be made, but I've never used tenancies.
5 replies