title: laravel: Relationship method must return an object of type Illuminate\Database\Eloquent\Relations\Relation
body: <p>I have 3 DB tables and I did not put any relationship on any of them. then I wrote the following code:</p>
  
  <pre><code>public function store($key)
  {
      $user_key = md5(Input::get('email') . "-" . strtotime('now'));
  
      $user = new User;
  
      $user-&gt;name = Input::get('name');
      $user-&gt;email = Input::get('email');
      $user-&gt;user_key = $user_key;
      $user-&gt;password = Hash::make(Input::get('password'));
      $user-&gt;apipass = md5(Input::get('password'));
      $user-&gt;save();
  
      $newUid = $user-&gt;id;
  
      //check key for share
      $invited = DB::table('invites')-&gt;where('invite_key', Input::get('invite_key'))-&gt;where('status', '0')-&gt;count();
  
      if($invited == 1) {
          $inviter_id = DB::table('invites')-&gt;where('invite_key', Input::get('invite_key'))-&gt;where('status', '0')-&gt;pluck('user_id');
          $read_only = DB::table('invites')-&gt;where('invite_key', Input::get('invite_key'))-&gt;where('status', '0')-&gt;pluck('read_only');
  
          $share = new RecordShare;
  
          $share-&gt;user_id = $inviter_id;
          $share-&gt;shared_with_id = $newUid;
          $share-&gt;read_only = $read_only;
          $share-&gt;save;
  
      }
  
      return Redirect::to('login');
  }
  </code></pre>
  
  <p>its supposed create a new user, then see who invited him, and then create a share record with the inviter.</p>
  
  <p>but when I test it, I got the error:</p>
  
  <blockquote>
    <p>LogicException</p>
    
    <p>Relationship method must return an object of type
    Illuminate\Database\Eloquent\Relations\Relation</p>
  </blockquote>
  
  <p>open: /home/oneinfin/public_html/dialysis/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php </p>
  
  <pre><code>    */
  protected function getRelationshipFromMethod($key, $camelKey)
  {
  $relations = $this-&gt;$camelKey();
  if ( ! $relations instanceof Relation)
  {
  throw new LogicException('Relationship method must return an object of type '
  . 'Illuminate\Database\Eloquent\Relations\Relation');
  }
  </code></pre>
  
  <p>I thought there was something wrong with my data and so tried to create an empty record</p>
  
  <pre><code>        $share = new RecordShare;
          $share-&gt;save;
  </code></pre>
  
  <p>but this also failed with the same error. The function only gets pass if I remove this part totally.</p>
  
  <p>what could be wrong? I tried to clear the cache, but still don't work.</p>