💾 Compilation of all shell commands

Compilation of all shell commands


Connect to a database

Configuration

Make sure your .env file has the right parameters.

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=nihon
DB_USERNAME=root
DB_PASSWORD=

⚠️ If you have an old Mysql

public function boot()
{
   Schema::defaultStringLength(191);
}

Create table and model

Command to create migration and model file

# Replace [xx] with the singular name of the table you want.
php artisan make:model --migration [Name]
# But if you want to create them separately
php artisan make:migration create_[name]s_table
php artisan make:model [Name]

Customise migration file

Be careful not to git the migration file before testing and reviewing it.

public function up()
{
    Schema::create('[name]s', function (Blueprint $table) {
        $table->id();
        $table->timestamps();
        $table->softDeletes();
    }
}

🆘 Here you can find all the types you will need: