Skip to content

Instantly share code, notes, and snippets.

@aranw
Forked from patrickmaciel/BaseController.php
Last active August 27, 2018 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save aranw/4633372 to your computer and use it in GitHub Desktop.
Save aranw/4633372 to your computer and use it in GitHub Desktop.
<?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);
}
}
}
<?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');
}
}
<?php namespace PatrickMaciel\Admin;
class ProjectsController extends \PatrickMaciel\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)
{
//
}
}
<?php
Route::get('/', 'PatrickMaciel\\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