Summarize the problem of PHP artisan migrate in Laravel

Source: Internet
Author: User
Tags autoload
This article mainly summarizes the introduction in Laravel 5.1 PHP artisan Migrate the use of notes, the article introduced in very detailed, the use of PHP artisan migrate has a certain reference learning value, the need for friends below to see it together. We hope to help you.

PHP artisan migrateCommands 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

Related recommendations:

Detailed Laravel Task Scheduler console

Detailed Laravel how to modify through the background. Env Configuration

How to use Laravel Event System to implement login log

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.