1. Create and update table structures with migration
PHP artisan make:migration create_users_table--create=users
php artisan make:migration add_votes_to_users_table- -table=users
PHP Artisan Migrate
In practical applications, there are two ways of doing this:
A. Each time the database has any changes, execute the make:migration command to generate a new migration class. The advantage is that you can keep all the history of database changes.
B. Each data table corresponds to a migration class, in the class with Schema::hastable ("some_table") to determine whether the table exists, walk CREATE table or update table process. Change the time in the file name each time you modify the class.
2. Fill the test data with Seeder
-PHP Artisan db:seed Error
If we write Seeder related code, and the code is not a problem, but the execution of PHP artisan db:seed still error,
is probably because the Seeder related file or code is not associated to the Laravel project, and a PHP artisan make:seed Sometableseeder is executed once
Yes, this sometableseeder can be any of the Seeder classes you write in the database/seeds/path.
Executing PHP artisan db:seed again will not be an error.