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
//create
$model::create( $request->all() );
//update
$model::fill( $request->all() )->save();
//migration
//make sure column active is created in migration
Schema::create('user', function(Blueprint $table)
{
$table->increments('id');
$table->string('name', 191)->nullable();
$table->string('email', 191)->nullable();
$table->string('username', 191)->nullable();
$table->string('password', 191)->nullable();
$table->boolean('active')->nullable();
$table->string('remember_token', 100)->nullable();
$table->timestamps();
$table->softDeletes();
});
//model
//make sure User model have these function
public function activateUser() {
$this->active = 1;
$this->save();
}
public function deActivateUser() {
$this->active = 0;
$this->save();
}
//LoginController
//make sure to call activateUser when login
$user = User::where('email','=',$request->email)->first();
if( $user->active == 1 ) {
return redirect('/login');
}
//LogoutController
//make sure to call deActivateUser when logout
public function logout()
{
Auth::user()->deActivateUser();
Auth::logout();
return redirect('/login');
}