Form builder component properties render
Hey there!
Can somebody point me where ViewComponent protected properties goes into view render?
I only see something like default Laravel behaviour with view('view-name', $this->data()) β where ->data() - collects public properties & methods, but how does protected properties goes here? π
Where is this secret method that collects protected properties from component?
Would much appreciate your help, guys! @danharrin @zepfietje @awcodes
9 Replies
protected properties arent collected
thats why we use public getter methods
Not sure Iβm following, but in livewire protected properties are more of an internal functionality which is why they are not fully exposed to the view, they should be only accessible on the server. Iβm sure Iβm wrong though.
i dont know if hes talking about livewire protected properties
Iβm not sure either
@awcodes I am talking about Filament View Components that used in Form Builder, not Livewire Component.
My question is β Which Filament method collects View component (https://github.com/filamentphp/filament/blob/2.x/packages/forms/src/Components/TextInput.php) protected variables and passes it to it's the blade view?
Default Laravel View Components collects only public variables to pass it to blade, so where is Filament method that collects protected properties? π
Sorry if you misunderstood me previously
GitHub
filament/TextInput.php at 2.x Β· filamentphp/filament
Admin panel, form builder and table builder for Laravel. Built with the TALL stack. Designed for humans. - filament/TextInput.php at 2.x Β· filamentphp/filament
it doesnt pass protected properties
use getter methods for proper encapsulation
Oh, makes sense. Where is this getter methods located?
the form component class
check out any of the built in form components, they all use protected properties and getter methods
Aww, now I see... It uses the results of component evaluated public methods in blade. Didn't noticed that before. Thanks a lot for clarification!