Internal Server Error Illuminate\Database\Eloquent\MassAssignmentException Add [name] to fillable property to allow mass assignment on [App\Models\User]. in Laravel 11

 





SOLUTION :
IN app\Models\User File, add below code to solve above Error

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    public $timestamps = false;
    // protected $guarded = [];     //we can write $guarded OR $fillable variable
    protected $fillable = ["name","email","age","city"];
}

Comments

Popular posts from this blog

Internal Server Error Exception Property [name] does not exist on this collection instance. in Laravel 11

Illuminate\Database\QueryException SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (Connection: mysql, SQL: alter table `roles` add unique `roles_role_name_unique`(`role_name`)) in Laravel 11