# Working with Database

#Database Migrations

Migrations are like version control for your database

Make Migrations

php artisan make:migration create_trainings_table

Run Migrations

php artisan migrate

Database

#Database Factories

Laravel has a feature called model factories that allows you to build fake data for your models

Make Factory

php artisan make:factory TrainingFactory

Run Factory

php artisan tinker

    factory('App\Training',10)->create();

Database

#Database Seeds

Laravel includes a simple method of seeding your database with test data using seed classes.

Make Seeder

php artisan make:seeder TrainingTableSeeder

Run Seeder

php artisan db:seed

Database

# How to create and run migrations, seeder and factory?

Here are the example.

Make Migrations

php artisan make:migration create_trainings_table

php artisan make:migration alter_articles_table_add_attachment

Run Migrations

php artisan migrate

Make Seeder

php artisan make:seeder TrainingTableSeeder

Run Seeder

php artisan db:seed

Make Factory

php artisan make:factory TrainingFactory

Run Factory

php artisan tinker