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

Shrutik's avatar

Code check and guidance

I am new to laravel (using laravel v11.45) and have gone through the documentation...but still for better clarity, I'd prefer to discuss this with a person... I have an existing database, which has different model other than the default user model provided by laravel/livewire/jetstream... I am using the authentictaion, authorization, email facility provided default by laravel/livewire/jetstream and for this to work I have made changes to the auth.php configuration file lke this -><?php return [ 'defaults' => [ 'guard' => env('AUTH_GUARD', 'web'), 'passwords' => env('AUTH_PASSWORD_BROKER', 'users'), ], 'guards' => [ 'web' => [ 'driver' => 'session', 'provider' => 'users', ], ],

'providers' => [
    'users' => [
        'driver' => 'eloquent',
        'model' => env('AUTH_MODEL', App\Models\Useraccount::class),
    ],

'passwords' => [ 'users' => [ 'provider' => 'users', 'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'), 'expire' => 60, 'throttle' => 60, ], ], 'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 60), ];

App\Models\Useraccount namespace App\Models;

use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Contracts\Auth\MustVerifyEmail; use Laravel\Fortify\TwoFactorAuthenticatable; use Carbon\Carbon; use Illuminate\Notifications\Notifiable; use Illuminate\Database\Eloquent\Collection; //using MustVerifyEmail Interface

class Useraccount extends Authenticatable implements MustVerifyEmail { // use HasApiTokens; use Notifiable, TwoFactorAuthenticatable; use HasFactory; use TwoFactorAuthenticatable;

protected $table = 'useraccount';
protected $primaryKey = 'user_id';
public $incrementing = false;
public $timestamps = false;
protected $keyType = 'string';

Is this correct, to point laravel to use my useraccount model ? And, will this cause any problem if i need to upgrade? Please guide me on this...

0 likes
3 replies
lsvagusa's avatar

I think you didn't finish your message? Can you finish it, so we can try and help?

1 like
Shrutik's avatar

I had added the code on a new line, and I think that's why it wasn't visible. But now that I've done what was required, please have a look.

Tray2's avatar

All code should be wrapped in three backticks ```

function doSomething()
{
  return 2 + 2;
}

Please or to participate in this conversation.