miomech
miomech
FFilament
Created by nowak on 3/30/2024 in #❓┊help
Can someone explain to my why ->dehydrated() works for storing data on disabled fields?
No problem my friend
7 replies
FFilament
Created by nowak on 3/30/2024 in #❓┊help
Can someone explain to my why ->dehydrated() works for storing data on disabled fields?
To more direcly answer your question if you want the textfield to send the data to the backend even when it's disabled you can simply do
TextInput('my_field')
->disabled()
->dehydrated() // this will force the data to send to the backend, remembere it is the same as ->deydrated(true)


// when you don't want to send data to the backend data simply do
TextInput('my_field')
->disabled() // this will automatically set ->dehyrdated(false) so the data is not sent to the backend
// ->dehyrdated(false) is not needed here.
TextInput('my_field')
->disabled()
->dehydrated() // this will force the data to send to the backend, remembere it is the same as ->deydrated(true)


// when you don't want to send data to the backend data simply do
TextInput('my_field')
->disabled() // this will automatically set ->dehyrdated(false) so the data is not sent to the backend
// ->dehyrdated(false) is not needed here.
7 replies
FFilament
Created by nowak on 3/30/2024 in #❓┊help
Can someone explain to my why ->dehydrated() works for storing data on disabled fields?
->dehydrated() is simply a shorthand for ->dehydrated(true) if you want the field to not be dehydrated you can add ->dehydrated(false) to it. dehydrated(false) in plain English means: "Don't send the data in this form field to the backend php" From my understanding when a form is "disabled" it is automatically set to ->dehydrated(false).
7 replies
FFilament
Created by miomech on 3/15/2024 in #❓┊help
How to mutate/format data for dehydration? (When using a custom field class)
Nevermind, figured out I need to use the hydrate method since that's what fills out the form.
3 replies
FFilament
Created by darcy1368 on 3/22/2024 in #❓┊help
Detect if view or edit page
So on the view page you just want to have an infolist? and on the edit page you want to have a form? just making sure I'm understanding things correctly.
5 replies
FFilament
Created by miomech on 7/21/2023 in #❓┊help
Filament v2 Is it possible to render a relation manager outside of the admin dashboard on blade
Thank you for your help @mark_chaney
8 replies
FFilament
Created by charliefortune on 7/21/2023 in #❓┊help
Convert Eloquent relationship to query builder for table?
You should be able to use toQuery on a model: https://laravel.com/docs/10.x/eloquent-collections#method-toquery In your table you should be able to use
protected function getTableQuery(): Builder
{
return $myModel->aRelationship()->toQuery();
}
protected function getTableQuery(): Builder
{
return $myModel->aRelationship()->toQuery();
}
I had something like that working at some point. Can't remember what I ended up doing 100% though.
3 replies