Created
January 25, 2013 00:35
-
-
Save patrickmaciel/4630347 to your computer and use it in GitHub Desktop.
Route with namespace in Laravel 4 - ERROR: Whoops, looks like something went wrong.
FatalErrorException: Error: Class 'PatrickMaciel\Admin\BaseController' not found in /home/..../app/controllers/admin/ProjectsController.php line 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace PatrickMaciel; | |
class BaseController extends Controller { | |
/** | |
* Setup the layout used by the controller. | |
* | |
* @return void | |
*/ | |
protected function setupLayout() | |
{ | |
if ( ! is_null($this->layout)) | |
{ | |
$this->layout = View::make($this->layout); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace PatrickMaciel; | |
class HomeController extends BaseController { | |
/* | |
|-------------------------------------------------------------------------- | |
| Default Home Controller | |
|-------------------------------------------------------------------------- | |
| | |
| You may wish to use controllers instead of, or in addition to, Closure | |
| based routes. That's great! Here is an example controller method to | |
| get you started. To route to this controller, just add the route: | |
| | |
| Route::get('/', 'HomeController@showWelcome'); | |
| | |
*/ | |
public function index() | |
{ | |
return View::make('home.index'); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace PatrickMaciel\Admin; | |
class ProjectsController extends BaseController { | |
/** | |
* Display a listing of the resource. | |
* | |
* @return Response | |
*/ | |
public function index() | |
{ | |
echo 'oi'; exit; | |
} | |
/** | |
* Show the form for creating a new resource. | |
* | |
* @return Response | |
*/ | |
public function create() | |
{ | |
// | |
} | |
/** | |
* Store a newly created resource in storage. | |
* | |
* @return Response | |
*/ | |
public function store() | |
{ | |
// | |
} | |
/** | |
* Display the specified resource. | |
* | |
* @return Response | |
*/ | |
public function show($id) | |
{ | |
// | |
} | |
/** | |
* Show the form for editing the specified resource. | |
* | |
* @return Response | |
*/ | |
public function edit($id) | |
{ | |
// | |
} | |
/** | |
* Update the specified resource in storage. | |
* | |
* @return Response | |
*/ | |
public function update($id) | |
{ | |
// | |
} | |
/** | |
* Remove the specified resource from storage. | |
* | |
* @return Response | |
*/ | |
public function destroy($id) | |
{ | |
// | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Route::get('/', 'HomeController@index'); | |
Route::get('admin/projects', 'PatrickMaciel\\Admin\\ProjectsController@index'); | |
// Route::resource('admin/projects', 'admin.ProjectsController'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment