Reputation: 113
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
Reputation: 11636
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