access request input
hello, I hope everyone is doing well.
how can I access request input, I tried the Laravel way using request('key') but returns null, tried to dd(request()=>all()) it returns some livewire component json data, is there any other way ? am I missing something ?
Thanks in advance guys.
14 Replies
request imput? form a form?
show us some code 😊
yes, form input, trying to access like request('key') returns null.
u using action? or what? just pass the param so like
function(array $data)
the u can access the data
actually this is not what im looking for, but here's some reference for access the submitted form u can see it here for using resource
https://filamentphp.com/docs/3.x/panels/resources/creating-records
and here for action
https://filamentphp.com/docs/3.x/actions/prebuilt-actions/create
actually, im trying to access from a model observer's create method.
Could you explain what are you trying to do?
hmm, what about this
https://laravel.com/docs/11.x/eloquent#observers
or let's say u create inside model boot
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
i'm trying to access data from a submitted form to do some calculations, using the results to decide whether to autorize the user to create the model in the observer.
Filament has some hooks that you can use to achieve it
https://filamentphp.com/docs/3.x/panels/resources/creating-records#halting-the-creation-process
You can also use Laravel observers https://laravel.com/docs/11.x/eloquent#observers
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
Solution
If you are using Filament hooks, you can access the data via
$this->data
sorry, i meant policy not observer
trying to acess from policy
i think i will just go with using filament hooks, thanks. @Leandro Ferreira @christmex