title: Laravel - How to restrict certain functionality based on user authentication?
body: <p>Laravel newbie here (obviously :D ). I've set up a new model &amp; controller for a model named <code>Pages</code>.</p>
  
  <p>Every <code>User</code> has many <code>Pages</code>.</p>
  
  <p>Each <code>Page</code> has a single <code>User</code>.</p>
  
  <p>I've created the following functioning controller actions (&amp; views):</p>
  
  <pre><code>PagesController::index
  PagesController::create
  PagesController::store
  PagesController::show
  PagesController::edit
  PagesController::delete
  </code></pre>
  
  <p>So you can edit a <code>Page</code> by going to <code>url.dev/pages/{id}/edit</code>.</p>
  
  <p>The problem is, you can access all of these routes regardless of your session status. So random users can edit any given <code>Page</code>. Which, obviously, is terrible.</p>
  
  <p><strong>Can anyone point me in the direction of what I should read up on, to limit the ability to access my model's controller actions based on whether or not the user is logged in (and if it's the <em>correct</em> user, at all)?</strong></p>