title: Laravel routing behavior with PJAX not as expected
body: <p>I'm building my first lavavel website from scratch and I've run into a behavioral issue with a few routes.</p>
  
  <p>Here is the relevant code for my routes file:</p>
  
  <pre><code>Route::get('work', 'PageController@work');
  Route::get('work/{item}', 'PageController@workitem');
  </code></pre>
  
  <p>And here are the relevant methods:</p>
  
  <pre><code>public function work() {
          return view('pages.work');
      }
  
      public function workitem($item) {
          $v = 'work.'.$item;
          if(view()-&gt;exists($v)) {
              return view($v);
          } else {
              return view('errors.noitem');
          }
      }
  </code></pre>
  
  <p>And here is the relevant part of my view:</p>
  
  <pre><code>@extends('layout')
  
  @section('content')
  ...
  &lt;div class="workflex"&gt;
      &lt;a class="workitem" href="/work/test"&gt;&lt;/a&gt;
      &lt;a class="workitem" href="/work/test2"&gt;&lt;/a&gt;
  &lt;/div&gt;
  &lt;div id="loadContent" class="loadContent"&gt;
      @yield('insert')
  &lt;/div&gt;
  ...
  @stop
  </code></pre>
  
  <p>It is worth mentioning that I intend to load the individual workitem pages with PJAX. I have views that the PJAX loads into the the "insert" section based on the URL:</p>
  
  <pre><code>$(document).pjax('a.workitem', '#loadContent');
  </code></pre>
  
  <p>The user loads the initial work page at the /work subdirectory, and clicks a button to load /work/item pages with PJAX. As the routes suggest, I also want the user to be able to enter a workitem into the URL and be directed to the work page already loaded with that item. This whole system behaves as intended... until I added the following jquery to work.blade.php:</p>
  
  <pre><code>$(document).ready(function() {  
          $('#loadContent').load("/work/init", function() {
              myFade('#loadContent &gt; *', 1); //ignore this function, it's an animation irrelevant to my problem
          });
      });
  </code></pre>
  
  <p>This is here as an attempt to load a initial message inside the PJAX loading div #loadContent to tell the user to select a workitem. However, a side effect of this is that now whenever I browser to a /work/item directly (PJAX still loads the pages correctly) the document triggers this jquery and the message overrides the page content.</p>
  
  <p>I was brainstorming ways to allow the work() method in my controller to trigger something that loads this script or passes just the work/init view into the "insert" section.</p>
  
  <p>What do you think would be the best way to solve this? Your answers are greatly appreciated.</p>