Laravel Cheatsheet

Some useful Laravel 4 commands below.

Config

In app/config/ there are various files (objects) like ‘app’, ‘auth’, ‘database’, and more. Configure them as you like. You can use Config::get($key) to access some configuration in real-time, e.g.Config::get('app.debug').

Redirect

Redirect::to('') or Redirect::to('/') Redirects to /public/
Redirect::route('someName') Redirects using a Named Route.

Named Routes

Route::get('user/profile', array('as' => 'profile', function() { ... })) or Route::get('user/profile', array('as' => 'profile', 'uses' => 'UserController@showProfile')); Associates the “user/profile” route with some function (or Controller method), and creates a Named Route to “user/profile” (so now when you’ll call Redirect::route('profile'); you’ll redirect to “user/profile”.