0

I am pretty new to laravel and currently exploring its concepts. In some videos I saw a concept of models inheritance. I wonder if we can use models relationships in laravel 5.6 then why we need to inherit models. In which case we need to or should inherit models.

eg Base Model:

class User extends Authenticatable
{

}

eg Child Model:

Class UserTypeOne extends User()
{
}

eg Child Model2:

Class UserTypeTwo extends User
{
}

Thanks in advance.

kajetons
  • 4,481
  • 4
  • 26
  • 37
aishazafar
  • 1,024
  • 3
  • 15
  • 35

1 Answers1

1

You don't really need to inherit Models like class inherit. You should use Eloquent Relationship instead. Prior to development, you have to do proper database designing.

https://laravel.com/docs/5.6/eloquent-relationships

Gabriel
  • 970
  • 7
  • 20