Created
October 9, 2014 13:16
-
-
Save ryanorsinger/3929b1c29a71c07ab6d3 to your computer and use it in GitHub Desktop.
routes and controller
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 | |
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 showWelcome() | |
{ | |
return View::make('home'); | |
} | |
public function showResume() | |
{ | |
return View::make('resume'); | |
} | |
public function showPortfolio() | |
{ | |
return View::make('portfolio'); | |
} | |
} |
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 | |
/* | |
|-------------------------------------------------------------------------- | |
| 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('/', array('uses' => 'HomeController@showWelcome', 'as' => 'home')); | |
/* | |
* Curly brackets specify a dynamic route parameter. | |
* @var name is passed in from the URI to the view. | |
*/ | |
Route::get('/sayhello/{name}', array('uses' => 'HomeController@sayHello', 'as' => 'sayhello')); | |
Route::get('/resume', array('uses' => 'HomeController@showResume', 'as' => 'resume')); | |
Route::get('/portfolio', array('uses' => 'HomeController@showPortfolio', 'as' => 'portfolio')); | |
Route::resource('posts', 'PostsController'); |
'host' => $_ENV['DB_HOST'],
'database' => $_ENV['DB_NAME'],
'username' => $_ENV['DB_USER'],
'password' => $_ENV['DB_PASS'],
<h4>{{ HTML::linkRoute('portfolio', 'Portfolio') }}</h4>
<h4>{{ HTML::linkRoute('resume', 'Resume') }}</h4>
<h4>{{ link_to_action('PostsController@index', 'Blog Roll') }}</h4>
<h4>{{ link_to_action('PostsController@create', 'New Post') }}</h4>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$env = $app->detectEnvironment(function()
{
});