When we create database in Laravel, we need to know dealing with Migration. Migration is way for versioning database in Laravel. Inside of Database Migrations there has two files by default. One is for users table and other is for password reset table.
Migration is nothing more than a Migration class and a migration has two method: up() and down()
up() method is dealing Schema structure all database create, edit, update and down() method is dealing opposite of up() method. We can study how to create table from default users table.
For creating default tables in Database we can run this command for creating all tables in Database
php artisan migrate
For creating our own table and migration we can create by this command
php artisan make:migration create_pages_table --create=content
In this command create_pages_table will be migration name &
–create=content will be table name and code will be like this:
class CreatePagesTable extends Migration
php artisan make:model Page --migration
php artisan make:model Page -
mAppServiceProvider.php
use Illuminate\Support\Facades\Schema;
And in the boot function
public function boot()
{
Schema::defaultStringLength(191)
}
php artisan make:auth