title: Cannot access eloquent relationship in laravel test
body: <p>I have the following relationship in <code>User</code> model and <code>UserLevel</code> model.</p>
  
  <p>User:</p>
  
  <pre><code>public function user_level()
  {
      return $this-&gt;belongsTo('App\UserLevel');
  }
  </code></pre>
  
  <p>UserLevel:</p>
  
  <pre><code>public function users()
  {
      return $this-&gt;hasMany('App\User');
  }
  </code></pre>
  
  <p>This works perfectly in Tinker as shown below:</p>
  
  <p><a href="https://i.stack.imgur.com/r6Sxl.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/r6Sxl.jpg" alt="enter image description here"></a></p>
  
  <p>But I can't seem to access the relationship in Laravel PHPUnit test. The following <code>die and dump</code> returns <code>null</code>:</p>
  
  <pre><code>class AddUserTest extends TestCase
  {
    use DatabaseMigrations;
  
    /** @test */
    public function super_admin_can_view_add_user_form()
    {
      $super_admin_user = factory(User::class)-&gt;create([
        'username' =&gt; 'Test User 6',
        'user_level_id' =&gt; 7,
      ]);
  
      dd($super_admin_user-&gt;user_level);
    }
  }
  </code></pre>
  
  <p>If I <code>dd</code> the <code>$super_admin_user</code>, it properly shows the created user. What am I doing wrong? How can I access the user_level in the test?</p>