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


dropdown with class

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

25 Laravel Tips and Tricks–pre-92818

Laravel 4 schema docs

Jeffrey Way Generator for Laravel 4

Documentation :

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