Laravel Mass Assignment: Fillable or Guarded

What is fillable?

Using models is one of the best facts in Laravel, but when using a model, it has three variables, and one of them is "fillable".You can define those fields which can be created/ filled by mass-assignment by use of fillable.

COMMAND

protected $fillable = ['first_name','last_name'];

For example, let's say you have a user model with:

protected $hidden = array('password');


No comments

Note: only a member of this blog may post a comment.