Laravel PHPArtisan Commands

Usage: php artisan <command name> Available commands: clear-compiled Remove the compiled class file down Put the application into maintenance mode env [...]

No supported encrypter found. The cipher and / or key length are invalid

If you saw this error in Laravel, then regenerate the APP key using php artisan key:generate This will solve the problem. [...]

Laravel Schema

Schema::create('table', function($table) { $table->increments('id'); }); // Specify a Connection Schema::connection('foo')->create('table', function($table){}); // Rename the table to a g [...]

Laravel Cache, Cookies and Sessions

Cache Cache::put('key', 'value', $minutes); Cache::add('key', 'value', $minutes); Cache::forever('key', 'value'); Cache::remember('key', $minutes, function(){ return 'value' }); Cache::remembe [...]

Laravel Request, Response and Redirect

// Request // url: Request::url(); // path: /aa/bb Request::path(); // getRequestUri: /aa/bb/?c=d Request::getRequestUri(); // Returns user's IP Request::getClientIp(); [...]

Laravel Eloquent

Model::create(array('key' => 'value')); // Find first matching record by attributes or create Model::firstOrCreate(array('key' => 'value')); // Find first record by attributes or instantiate M [...]

Laravel App, Log, URLs and Events

App App::environment(); // test equal to App::environment('local'); App::runningInConsole(); App::runningUnitTests(); Log Log::info('info'); Log::info('info',array('context'=>'additio [...]

Artisan Cheat Sheet

// Displays help for a given command php artisan --help OR -h // Do not output any message php artisan --quiet OR -q // Display this application version php artisan --version OR -V // Do not a [...]