title: Different user types laravel
body: <p>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.</p>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>This is how my User Model looks like:</p>
  
  <pre><code>public function userable()
  {
      return $this-&gt;morphTo();
  }
  </code></pre>
  
  <p>And this is how one the childs look like:</p>
  
  <pre><code>public function user()
  {
      return $this-&gt;morphOne('User', 'userable');
  }
  </code></pre>