title: Laravel 4 - changing resource root routing path
body: <p>In a Laravel 4 installation, Using <a href="https://github.com/JeffreyWay/Laravel-4-Generators#resources" rel="nofollow noreferrer">Jeffrey Way's Laravel 4 Generators</a>, I set up a 'tweet' resource, using the scaffolding command from his example:</p>
  
  <pre><code>php artisan generate:scaffold tweet --fields="author:string, body:text"
  </code></pre>
  
  <p>This generated the model, view, controller, migration and routing information for the tweet type. After migrating the database, visiting <code>http://localhost:8000/tweets</code> works fine, and shows the expected content.</p>
  
  <p>The contents of the <code>routes.php</code> file at this point is:</p>
  
  <pre><code>Route::resource('tweets', 'TweetsController');
  </code></pre>
  
  <hr>
  
  <p>Now I would like to move the url for <code>tweets</code> up one level into <code>admin/tweets</code>, so the above url should become: <code>http://localhost:8000/admin/tweets</code>. Please note that I am not treating 'Admin' as a resource, but instead just want to add it for hypothetical organizational purposes.</p>
  
  <p>Changing the routes.php file to:</p>
  
  <pre><code>Route::resource('admin/tweets', 'TweetsController');
  </code></pre>
  
  <p>Does not work, and displays the following error:</p>
  
  <blockquote>
    <p>Unable to generate a URL for the named route "tweets.create" as such route does not exist.</p>
  </blockquote>
  
  <p>Similarly when using the following:</p>
  
  <pre><code>Route::group(array('prefix' =&gt; 'admin'), function() {
      Route::resource('tweets', 'TweetsController');
  });
  </code></pre>
  
  <p>As was suggested in <a href="https://stackoverflow.com/questions/14585654/laravel-4-nested-resource-controllers-routeresourceadmin-photo-photocontr">this stackoverflow question</a>.</p>
  
  <p>Using <code>php artisan routes</code> reveals that the named routes also now have <code>admin</code> prefixed to them, turning <code>tweets.create</code> into <code>admin.tweets.create</code>.</p>
  
  <hr>
  
  <p>Why is the error saying that it cannot find <code>tweets.create</code>? shouldn't that automatically be resolved (judging by the routes table), to use <code>admin.tweets.create</code>?</p>
  
  <p>How can I change my routing so that this error no longer occurs?</p>