Guarded foreign id
I wonder how will you associate a guarded/not in fillable foreign id when creating a new record.
4 Replies
I think you should look into the Lifecycle hooks.
https://beta.filamentphp.com/docs/3.x/panels/resources/creating-records#lifecycle-hooks
You probably want to set these id's in the beforeCreate lifecycle hook.
Untested, but probably you want to do something like this:
Can you clarify your question. Are you asking how to do something in filament? Or how is filament handling table relationship?
If the later, it’s Laravel eloquent, read more here https://laravel.com/docs/10.x/eloquent#mass-assignment
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 looking for ways to properly approach this scenario I have.
resource: https://gist.github.com/dansingian/d1705d6bb133ffd9fca4aaed7828b5bb
create: https://gist.github.com/dansingian/6a05722006d72d1ed2fed80c4890b063