Massassignmentexception In Model.Php Line 448 Name Dictionary

Lets for arguments sake say this is our database columns : username, password and finally accessLevel

With the create method you pass through an Array of post data lets take this example :

now with this approach we are not assigning input to specific fields in the database like we would using the save() approach so i can easily modify the html add a form element with the id accessLevel ( with a lucky guess or something ) and set it equal to 1 and that for instance that could resemble admin access.

With the save() method we assign exactly what we want to store where thus there cannot be a mass assignment even if post data is added to the request it will just be discarded.

If however you are not passing Input::all() to the create() method and simply passing input::only() i think it might be something with the design regarding the create method. I'm not to sure about this, but whether you pass input::all() or input::only(), the create() method still gets and array so i think it won't be able to differentiate between the 2 thus the mass assignment exception is added and $fillable or $gauderd array is needed within the model to discard unwanted post data.

This is just my thought and how i understand the subject. take it with a pinch of salt.


Just wanting to add i treat Laravel like a TV remote, i press the button and the channel changes, i'm not too concerned how the remote does what it does all i know is i get the channel i want. :) if you really want to know why i would suggest having a look at the create() method and see if you can gather why this is the case.

Сознание нехотя подтверждало то, о чем говорили чувства. Оставался только один выход, одно решение. Он бросил взгляд на клавиатуру и начал печатать, даже не повернув к себе монитор. Его пальцы набирали слова медленно, но решительно.

0 Replies to “Massassignmentexception In Model.Php Line 448 Name Dictionary”

Lascia un Commento

L'indirizzo email non verrà pubblicato. I campi obbligatori sono contrassegnati *