Skip to content

Instantly share code, notes, and snippets.

@JBreit
Last active August 29, 2015 13:57
Show Gist options
  • Save JBreit/9821620 to your computer and use it in GitHub Desktop.
Save JBreit/9821620 to your computer and use it in GitHub Desktop.
<?php
class Authors_Controller extends Base_Controller {
public $restful = true;
public function get_index(){
$view = View::make('authors.index',array('name'=>'Andrew Perkins'))
->with('age', '28');
$view->location = 'California';
$view['specialty'] = 'PHP';
return $view;
}
}
<?php
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);
}
}
}
<h1>Authors Home Page</h1>
<?php echo $name; ?><br />
<?php echo $age; ?><br />
<?php echo $location; ?><br />
<?php echo $specialty; ?><br />
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
Route::get('/', function()
{
return View::make('hello');
});
Route::get('authors', array('uses'=>'authors@index'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment