I was making a basic CRUD app from a tutorial but realised I wanted to mask the feature inside an admin folder.
The feature was a blog management system (index, create, show, delete etc) and this all ran from domain.com/blog.
Since then, I have built a user system and a protected admin area so have decided to move the view files into an admin folder.
To counter this change, I asked on here and was instrcuted to wrap my resource route in this:
Route::group(array('before' => 'is_admin', 'namespace' => 'admin', 'prefix' => 'admin'), function()
Route::resource('blog', 'BlogController');
});
Then move my BlogController into an admin folder in my controller folder, then add a namespace to that controller:
namespace Admin;
and add a backslash before the BaseController.
This line here:
return View::make('admin/blog.index', compact('blogs'));
Was causing errors, so I had to add a backslash before the View::
return \View::make('admin/blog.index', compact('blogs'));
How do I not have to do that for all the classes?
And then once that is okay, my index file contains:
{{ link_to_route('blog.create', 'Add new blog') }}
Which is returning undefined route errors... where am I going wrong? The resource route should be catching these routes etc surely? Seems alot of work to simply make the BlogController work in an admin directory...