6/5/2017 - 5:57 AM

Laravel Framework

Here are some commands that useful in Laravel framework

//thing to do after cloning a project
composer install
cp .env.example .env
php artisan key:generate
php artisan migrate

//create database model along with it migration
php artisan make:model -m 

//migrate all migrations file
php artisan migrate

//list all route
php artisan route list

//seed data into database
php artisan db:seed
1 - Doctrine/dbal
2 - Laravel Auditing
3 - Laravel model status
$model::create( $request->all() );

$model::fill( $request->all() )->save();
//make sure column active is created in migration

Schema::create('user', function(Blueprint $table)
			$table->string('name', 191)->nullable();
			$table->string('email', 191)->nullable();
			$table->string('username', 191)->nullable();
			$table->string('password', 191)->nullable();
			$table->string('remember_token', 100)->nullable();
//make sure User model have these function

public function activateUser() {

    $this->active = 1;

public function deActivateUser() {

    $this->active = 0;

//make sure to call activateUser when login

$user = User::where('email','=',$request->email)->first();
if( $user->active == 1 ) {
    return redirect('/login');

//make sure to call deActivateUser when logout

public function logout()
	return redirect('/login');