lili luna
lili luna

Reputation: 113

User model extends Authenticatable and extends Model (for eloquent purpose)

I have a User Model that extends Authenticatable. But I want that User Model to extends Model at the same time. This is because I want to make the hasmany() relationship in this Model. Do you guys have a way on how can I do this?

use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Spatie\Permission\Traits\HasRoles;
use Illuminate\Database\Eloquent\Model;

class User extends Authenticatable
{
......
}

Upvotes: 1

Views: 1685

Answers (1)

Sapnesh Naik
Sapnesh Naik

Reputation: 11636

Authenticatable has already inherited Model class.

If you follow Illuminate\Foundation\Auth\User you will find that it is inherited from a Model class. So, your User model has the same features that your other models have.

Therefore, your hasmany() relation should work without any issues. Refer to the documentation for more information.

Upvotes: 4

Related Questions