Add [title] to fillable property to allow mass assignment on [App\Post]

The alternative to protected $fillable = ['title']; would be :

protected $guarded = [];  

and leave it as an empty array, without the need to define anything inside. It is the exact opposite of $fillable, sort of like telling the database to accept everything, except the fields you specify inside the $guarded array.


Add a title to the fillable array in your model Post, to allow saving through creating and massive methods

protected $fillable = ['title'];

For $fillable all

protected $guarded = ['id']; 

Tags:

Php

Laravel