title: BadMethodCallException in Builder.php line 2345: Call to undefined method Illuminate\Database\Query\Builder::notes()
body: <p>i'm getting the above error while following laravel from scratch tutorials from laracats.com,
  bellow is full error message</p>
  
  <p>Whoops, looks like something went wrong.
  1/1 BadMethodCallException in Builder.php line 2345: Call to undefined method Illuminate\Database\Query\Builder::notes()</p>
  
  <pre><code>in Builder.php line 2345
  at Builder-&gt;__call('notes', array())
  at Builder-&gt;notes()
  at call_user_func_array(array(object(Builder), 'notes'), array()) in Builder.php line 1426
  at Builder-&gt;__call('notes', array())
  at Builder-&gt;notes()
  at call_user_func_array(array(object(Builder), 'notes'), array()) in Model.php line 3505
  at Model-&gt;__call('notes', array()) in NotesController.php line 19
  at Note-&gt;notes() in NotesController.php line 19
  at NotesController-&gt;store(object(Request), object(Card))
  at call_user_func_array(array(object(NotesController), 'store'), array(object(Request), 'card' =&gt; object(Card))) in Controller.php line 80
  at Controller-&gt;callAction('store', array(object(Request), 'card' =&gt; object(Card))) in ControllerDispatcher.php line 146
  at ControllerDispatcher-&gt;call(object(NotesController), object(Route), 'store') in ControllerDispatcher.php line 94
  at ControllerDispatcher-&gt;Illuminate\Routing\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
  at Pipeline-&gt;then(object(Closure)) in ControllerDispatcher.php line 96
  at ControllerDispatcher-&gt;callWithinStack(object(NotesController), object(Route), object(Request), 'store') in ControllerDispatcher.php line 54
  at ControllerDispatcher-&gt;dispatch(object(Route), object(Request), 'App\Http\Controllers\NotesController', 'store') in Route.php line 174
  at Route-&gt;runController(object(Request)) in Route.php line 140
  at Route-&gt;run(object(Request)) in Router.php line 724
  at Router-&gt;Illuminate\Routing\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request)) in VerifyCsrfToken.php line 64
  at VerifyCsrfToken-&gt;handle(object(Request), object(Closure))
  at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
  at ShareErrorsFromSession-&gt;handle(object(Request), object(Closure))
  at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request)) in StartSession.php line 64
  at StartSession-&gt;handle(object(Request), object(Closure))
  at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
  at AddQueuedCookiesToResponse-&gt;handle(object(Request), object(Closure))
  at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request)) in EncryptCookies.php line 59
  at EncryptCookies-&gt;handle(object(Request), object(Closure))
  at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
  at Pipeline-&gt;then(object(Closure)) in Router.php line 726
  at Router-&gt;runRouteWithinStack(object(Route), object(Request)) in Router.php line 699
  at Router-&gt;dispatchToRoute(object(Request)) in Router.php line 675
  at Router-&gt;dispatch(object(Request)) in Kernel.php line 246
  at Kernel-&gt;Illuminate\Foundation\Http\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44
  at CheckForMaintenanceMode-&gt;handle(object(Request), object(Closure))
  at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
  at Pipeline-&gt;then(object(Closure)) in Kernel.php line 132
  at Kernel-&gt;sendRequestThroughRouter(object(Request)) in Kernel.php line 99
  at Kernel-&gt;handle(object(Request)) in index.php line 54
  at require_once('/home/archie/public_html/my_blog/public/index.php') in server.php line 21
  </code></pre>
  
  <p>My NotesController is as below</p>
  
  <pre><code> namespace App\Http\Controllers;
  
  use App\Card;
  use App\Note;
  use Illuminate\Http\Request;
  
  
  class NotesController extends Controller
  {
      public function store(Request $request, Card $card)
      {
  
  
          $note = new Note;
  
          $note-&gt;body = $request-&gt;body;
          $note-&gt;notes()-&gt;save($note);
  
          return back;
  
  
  }
  }
  </code></pre>
  
  <p>Card Model is as below</p>
  
  <pre><code> namespace App;
  
  use Illuminate\Database\Eloquent\Model;
  
  class Card extends Model
  {
     public function notes()
     {
      return $this-&gt;hasMany(Note::class);
     }
  
     public function path()
     {
      return '/cards/'.$this-&gt;id;
     }
  }
  </code></pre>