I'm fairly new to laravel-5 and I love it so far, but I've come out with this doubt while I was working on my project.
In my app I want different user types, let's say Employee, Admin and Freelance. Every type will have ofcourse, different permissions and acces to pages. Since every user type has different data, I created 3 additional tables to my schema, admins, employees and freelancers, and added a field user_type on the users default table, to link it to the new tables, which have a user_type aswell, keeping my default users table small as possible, just login info.
So I started reading around and I came up with polymorphic relationship on eloquent, which apparently is exactly what I wanted. After implementing those models relationships and migrations, I don't know how to keep moving, and how to check if a user is either freelancer, admin or employee and how to give acces to certain page regarding the usertype.
This is how my User Model looks like:
public function userable()
{
return $this->morphTo();
}
And this is how one the childs look like:
public function user()
{
return $this->morphOne('User', 'userable');
}