
Add [name] to fillable property to allow mass assignment on [App\Models\Project]
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.
Answers 1
-
Fillable Attribute in a Laravel model
--PATH app\Models\Project.phpclass Project extends Model { use HasFactory; protected $fillable = ['name'];
0Add 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.
Random Code Snippet Queries: Laravel
- Database transactions in laravel
- Attempt to read property "avatar" on null in Laravel
- How to add columns in existing table using migration in laravel
- How to pass query string with pagination in laravel
- Route [password.request] not defined
- SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'user_id'
- Use withCount() to Calculate Child Relationship Records
- How to display order by null last in laravel
- Display first n record from collection in laravel view
- How to add a key value pair to existing array in laravel
- Add a subselect based on relationship using withAggregate method
- How to customize or Change validation error messages
- Laravel change date format
- Method Illuminate\Events\Dispatcher::fire does not exist
- Where to use whereNotNull eloquent in laravel
- How to check duplicate entry in laravel
- How to get route method name in Laravel
- Global scope in Laravel with example
- Laravel upload file with original file name
- Laravel 9 route group with controller
- InRandomOrder() method with example in laravel
- Laravel API response format
- Multiple Level eager loading in Laravel
- Declaration of App\Models\Post::sluggable() must be compatible with Cviebrock\EloquentSluggable\Sluggable
- How to upload image in laravel 8