laravel requiring name in fillable array while it’s in it


my problem is when I register a new user, after I submit the post request it throws an exception saying Add [name] to fillable property to allow mass assignment on [IlluminateFoundationAuthUser] and its already exist in fillable.

namespace AppHttpControllersAuth;

/*imports here*/

class SignupController extends Controller
    public function store(Request $request)
        $this->validate($request, [
            'name' => 'required',
            'surname' => 'required',
            'username' => 'required|min:3|max:20',
            'phone' => 'required',
            'email' => 'required',
            'password' => 'required|confirmed',

            'name'=> $request->name,
            'surname'=> $request->surname,
            'username'=> $request->username,
            'phone'=> $request->phone,
            'email'=> $request->email,
            'password'=> Hash::make($request->password),

and when I execute php artisan migrate, it throws

Migrating: 2022_01_14_124437_add_username_to_users_table


  Call to undefined method IlluminateDatabaseSchemaMySqlBuilder::dropColumnIfExists()

  at C:UsersxxgamOneDriveDesktopprojectsdenemevendorlaravelframeworksrcIlluminateSupportFacadesFacade.php:261
    257▕         if (! $instance) {
    258▕             throw new RuntimeException('A facade root has not been set.');
    259▕         }
  ➜ 261▕         return $instance->$method(...$args);
    262▕     }
    263▕ }

  1   C:UsersxxgamOneDriveDesktopprojectsdenemedatabasemigrations22_01_14_124437_add_username_to_users_table.php:16

  2   C:UsersxxgamOneDriveDesktopprojectsdenemevendorlaravelframeworksrcIlluminateDatabaseMigrationsMigrator.php:394

C:UsersxxgamOneDriveDesktopprojectsdeneme>php artisan migrate:rollback
Rolling back: 2019_12_14_000001_create_personal_access_tokens_table
Rolled back:  2019_12_14_000001_create_personal_access_tokens_table (6.35ms)

C:UsersxxgamOneDriveDesktopprojectsdeneme>php artisan migrate
Migrating: 2019_12_14_000001_create_personal_access_tokens_table
Migrated:  2019_12_14_000001_create_personal_access_tokens_table (264.26ms)
Migrating: 2022_01_14_124437_add_username_to_users_table
Migrated:  2022_01_14_124437_add_username_to_users_table (115.22ms)

User Class

namespace AppModels;

use IlluminateContractsAuthMustVerifyEmail;
use IlluminateDatabaseEloquentFactoriesHasFactory;
use IlluminateFoundationAuthUser as Authenticatable;
use IlluminateNotificationsNotifiable;
use LaravelSanctumHasApiTokens;

class User extends Authenticatable
    use HasApiTokens, HasFactory, Notifiable;

    protected $fillable = [

    protected $hidden = [

    protected $casts = [
        'email_verified_at' => 'datetime',

I only know the basics in laravel, so if I missed something to write here tell me and I’ll write it.

Source: Laravel

Categorised as authentication, laravel, model-view-controller, php Tagged , , ,


Leave a Reply

Still Have Questions?

Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us