This article mainly summarizes the introduction of the Laravel 5.1 PHP artisan Migrate the use of notes, the article introduced in very detailed, for everyone to use PHP artisan migrate has a certain reference learning value, the need for friends below to see it together.
PHP artisan migrate
Commands are a very important issue for laravel, but there are several things to keep in mind when using them:
(1) Create a new table under the Migration folder to use the php artisan make:migration
statement
PHP Artisan already has a powerful function, do not create a new table on its own
(2) Use of composer Dump-autoload
Composer Dump-autoload is used to update the vendor/composer/autoload_classmap.php file, this file has many configurations, the use of php artisan
the command is to call this file in advance. When a new table is added, execute this command first, using migrate. After deleting a note, use Migrate:rollback first, then use composer to delete the file.
Executing this statement modifies all files under the vendor/composer/folder in the Laravel framework
(3) Installation composer
It is possible to use composer when the show command does not exist, then install composer.
Php-r "ReadFile (' Https://getcomposer.org/installer ');" > composer-setup.php php composer-setup.php php- R "Unlink (' composer-setup.php ');"
The composer-setup.php script that executes the first command will simply detect the parameter settings in the php.ini, give a warning if some parameters are not set correctly, and then download the latest version of the Composer.phar file to the current directory.
The functions of the above 3 commands are:
Download the installation script (composer-setup.php) to the current directory.
Perform the installation process.
Delete the installation script--composer-setup.php.
The global installation is to install Composer under the path contained in the system environment variable path, and then be able to execute the Composer command directly in the command-line window.
Mac or Linux system: Open a command-line window and execute the following command to move the previously downloaded Composer.phar file to the/usr/local/bin/directory:
sudo mv Composer.phar/usr/local/bin/composer