Skip to content

Instantly share code, notes, and snippets.

@ryanorsinger
Created October 9, 2014 13:16
Show Gist options
  • Save ryanorsinger/3929b1c29a71c07ab6d3 to your computer and use it in GitHub Desktop.
Save ryanorsinger/3929b1c29a71c07ab6d3 to your computer and use it in GitHub Desktop.
routes and controller
<?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');
}
}
<?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');
@ryanorsinger
Copy link
Author

$env = $app->detectEnvironment(function()
{

if (!empty($_SERVER['LARAVEL_ENV'])) {
    return $_SERVER['LARAVEL_ENV'];
}

return 'local';

});

@ryanorsinger
Copy link
Author

        'host'      => $_ENV['DB_HOST'],
        'database'  => $_ENV['DB_NAME'],
        'username'  => $_ENV['DB_USER'],
        'password'  => $_ENV['DB_PASS'],

@ryanorsinger
Copy link
Author

<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