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

Created 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

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Buy Me A Coffee

Don't forget to share this article! Help us spread the word by clicking the share button below.

We appreciate your support and are committed to providing you valuable and informative content.

We are thankful for your never ending support.