Daniel Gafitescu Freelance web developer focused on open source solutions

1Jun/130

Laravel4 snippets

1. Web server configuration

For Apache , Nginx & lighttpd

https://github.com/daylerees/laravel-website-configs

 

2. Optional route parameter

 

Route::get('/country/{country_name?}',function($country_name="Romania")
{ 
 return "Returning info from  {$country_name} ."; 
});

So when the url will be

 /country - I will display

Returning info from Romania

 /country/USA - I will display

Returning info from USA

3. Multiple filters

You can call multiple filter using the | pile line.


Route::get('/safe',array(
	'before' => 'auth|is_allowed', function()
  	 return View::make('gold'); }
));