Add [name] to fillable property to allow mass assignment on [App\Models\Project]

Updated at 23-Apr-2021, By samar

Add [name] to fillable property to allow mass assignment on [AppModelsProject]

Good day, guys. In this post, we’ll look at how to solve the "Add [name] to fillable property to allow mass assignment on [AppModelsProject]" programming puzzle.

You have to add table columns name into protected $fillable attribute to avoid Error Add [name] to the fillable property to allow mass assignment on [App\Models\Project] in your model. Mass assignment refers to sending an array to the model to directly create a new record in the database table.
  • Fillable Attribute in a Laravel model

    --PATH app\Models\Project.php
    class Project extends Model
    {
        use HasFactory;
    
        protected $fillable = ['name'];
    

    Add table columns name into the model fillable property after creating the Laravel model. $fillable attribute is an array containing all those columns of the table which can be filled using mass-assignment.

Back to code snippet queries related laravel