Useful Laravel command

This is a collection of useful Laravel command during development

Check environment via command

php artisan env

Generate secret key to use in config file

php artisan key:generate
php artisan key:generate --env=local

Reset autoload incase include file is missing

composer dump-autoload

Var_dump equivalent with exit, and convert to array

dd($question->toArray());

dropdown with class

//function create
$questions = Question::lists('title', 'id');
 
//create.blade.php
{{ Form::select('question_id', $questions , null, array('class' => 'form-control')) }}

25 Laravel Tips and Tricks

http://code.tutsplus.com/tutorials/25-laravel-tips-and-tricks–pre-92818

Laravel 4 schema docs

http://laravel.com/docs/4.2/schema#adding-columns

Jeffrey Way Generator for Laravel 4

Documentation : https://github.com/JeffreyWay/Laravel-4-Generators

Generate migration to create normal table

php artisan generate:migration create_questions_table

Run the migration

php artisan migrate

Rollback the migration (undo)

php artisan migrate:rollback

Generate single model

php artisan generate:model Question

Generate single view

php artisan generate:view admin.questions.index

Generate migration, model, view, controller in one command

php artisan generate:resource question

Generate migration, model, view, controller with sample code in one command

php artisan generate:scaffold choice

Other migration command

php artisan generate:migration add_fields_to_choices_table
php artisan generate:migration remove_fields_to_choices_table
php artisan generate:migration drop_choices_table