Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

AndyDTK's avatar

Add Field to Laravel Breeze Authentication

Hi,

I have added a field called "administrator" in DB of users table of Laravel Breeze. I have added the field in table and in user model

protected $fillable = [
    'name',
    'email',
    'password',
    'administrator'
];

Now I need to retrieve the value of that field in a controller, but the command:

$ammCheck = Auth::administrator();

return this error:

Method Illuminate\Auth\SessionGuard::administrator does not exist.

I have inclueded the Illuminate\Support\Facades\Auth in the controller.

Why that dosn't work?

Thanks and best regards...

0 likes
3 replies
Shivamyadav's avatar

You can't directly access it like that , it's not a facades property or method. It's a just a field in your table and in form. You can do something like this to get the administrator value once user is logged in . $adm = Auth::user()->administrator; And show me your controller method where you are writing this .

AndyDTK's avatar

SOLVED: I have mismatched the name of the field; in DB was "admin"...

    $user = auth()->user();
           
    if ($user->admin == 1)
        {...

I have also correct model: now works perfectly.

Thank you!

Please or to participate in this conversation.