I study Laravel and until the end I can not understand the attributes 'fillable', 'hidden' and 'guarded' for mass assignment.
The documentation states that for mass assignment using 'fillable' 'unclean' users can override any parameter for mass assignment. To do this, you need to add a field that you want to protect in 'guarded' and supposedly now you can massively designate 'safe'. Is it so? Then a few questions:
- Why not immediately insert all the fields in 'guarded'?
- Why the attribute is 'hidden', it is not said about it anywhere ... I noticed that the fields added to 'hidden' are simply not available from the global variable 'Auth'
- No problem is better to use:
$flight = new Flight; $flight->name = $anyname; $flight->save(); and everything will be tiptop?
guardedthen you will not be able to change them either, most oftenidwill be entered there. 3. As an option, but this is not a mass appointment. - Anton Kucenko