database structure is synchronized with him. Let's take a look at the specifics of how to use them.
Migrate
Laravel the PHP code that writes the database changes is called the migration, you can php artisan make:migration filename create the migration file in a way. Assuming you need to create a new user table, you can create a migration file by executing it, and the php artisan make:migration create_user
-person development project, your colleague modifies a database structure and modifies the code, and with Git you can instantly synchronize your colleague's modified code, but the database structure, You can only copy your colleague's modified SQL statements manually, and execute them to ensure that the database is structurally consistent. The concept of database migration in Laravel, then, is the solution to ensure that the database structure is consistent in the team.
Migration is very simple
corresponding to the Laravel facade
Before using this extension package, many people may have encountered the problem that PHPStorm cannot automatically complete the Facade (Facade). now Laravel IDE Helper Generator brings us the gospel. Run the following command to generate a file containing the facade completion information:
php artisan ide-helper:generate
Note: bootstrap/compiled. php needs to be cleared before Generation. Therefore, run php
Create and delete an application view file through the ArtisanView extension package in Laravel 1. Introduction
This extension package adds two Artisan commands related to the view to the Laravel application, so that we can use the Artisan command to create and manage the view file, which is further a relief of productivity.2. Installation
Or install it through Composer:
composer require sven/
Performance has always been a point of Laravel framework, so tuning the Laravel program is a must-learn skill. Next, share some of the best practice www.itxdl.cn and tuning tips, and you'll also be welcome to comment on other suggestions. Here is a simple list: Configure information cache artisan Config:cache route cache artisan Route:cache class map load optimization
people have encountered the use of Phpstorm can not automatically fill the façade (facade) problem, now Laravel IDE Helper Generator bring us the gospel. We use the following command to generate a file containing the façade completion information:
PHP Artisan Ide-helper:generate
Note: Before you need to clear bootstrap/compiled.php, you need to run PHP artisan clear-compiled and then run PHP
;
Use App\http\controllers\videocontroller;
Use Illuminate\contracts\filesystem\filesystem;
$this->app->when (Photocontroller::class)
->needs (filesystem::class)
->give (function () { Return
Storage::d ISK (' local ');
$this->app->when (Videocontroller::class)
->needs (filesystem::class)
->give (function () { Return
Storage::d ISK (' S3 ');
};
parameter type declaration: By giving a hint to the constructor parameter
Many people may be learning the Laravel framework, the Laravel Database Migration (hereinafter referred to as migration) There is doubt: what is migration. Why to use migration. Migration in the end convenient where.
Well, with these questions, we will come together today to study migration.
Question 1: What is migration.
Answer: You can view migration as a type of VCs (version control System) of a database, or versioning systems. You can use the Laravel Art
configuration (Homestead的默认用户名和密码为homestead和secret) , if you are directly using php artisan serve this way to open the service to develop, then modify your configuration accordingly. Why should laravel take such a configuration? A big reason might be to consider the security and convenience of the file, so that when we need to push the code to coding or github, we can ignore the .env file directly without worrying about the disclosure of our core inf
advance and you can name it at will:
'mysql' => array( 'driver' => 'mysql', 'host' => 'localhost', 'database' => 'database', 'username' => 'root', 'password' => '123456', 'charset' => 'utf8', 'prefix' => '', ),
Create a database
Then we will use Artisan and Migrations tools to create a database. You can simply think of it as a database tool, and we need to initialize it before u
Laravel database migration reports an error.
Use the migrate: make command of the Artisan command line to create a migration: (use in command line mode)
php artisan migrate:make create_users_table
All the migration files are stored in the app/database/migrations folder. the files are named with timestamps to facilitate the Laravel framework to define the order of these files by time.
You can use the -
This article mainly introduces the method of database migration of Laravel, small series think very good, now share to everyone, also give you a reference. Follow the small series together to see it, hope to help everyone.
Build migration
The--table and--create options can be used to specify the name of the data table or a new data table that will be created when the migration is executed. These options are required to fill in the specified data table when the migration file is pre-generated:
it from the W/O page refresh list.
In general, these are very simple concepts. We focus on the intricate relationships between Laravel and Angular.
Laravel backendSet Laravel
Continue to set up your Laravel. We will do some basic work to add, delete, modify, and query comments on Our backend:
Create a database for Migration
Implant sample comments into the database
Create a route table for our API
Create a "get all" route table for Angular Routing
Create a Resource Controller for c
forms and comments we created;
Be able to create a new comment and add it to our w/o page refresh list;
The ability to delete a comment and remove it from the w/o page refresh list.
In general, these are very simple concepts. Our focus is on the intricate relationship between how laravel and angular work together.
Laravel back endSet Laravel
Continue to set up your laravel, we will do some basic work to make our back-end implementation of comments and additions and deletions to chang
Performance has always been a point of Laravel framework, so tuning the Laravel program is a must-learn skill.Next share some of the best practices for development, as well as tuning tips, and you are welcome to comment on other suggestions.Here is a simple list:Configuration information Cache artisan Config:cache route cache Artisan Route:cache class-Map load optimization
Performance has always been a point of laravel framework, so tuning Laravel program is a must-learn skill. Next, share some of the best practices of development, as well as tuning techniques, and we have other suggestions and comments to discuss.
Performance has always been a point of laravel framework, so tuning Laravel program is a must-learn skill.
Next, share some of the best practices of development, as well as tuning techniques, and we have other suggestions and comments to discuss.
Her
, way/generators, which is its name in the composer library. Add the following content to composer. json:
"Require-dev ":{"Way/generators ":"~ 2.0"}, Similar to "require", put it below, not inside ~.
Run composer update and add the configuration at the appropriate location in./app/config/app. php:
The installation of 'way \ Generators \ generatorsserviceprovider' has been completed. run php artisan in the command line to see many new functions of th
. Routes, controller, and view are basically different from symfony, but it is not difficult to get started. Finally, let's take a look at queue.
1. Installing laravle and using composer is simple.
composer global require "laravel/installer=~1.1"vi ~/.bash_profile
Change ~ /. Composer/vendor/bin is added to the environment variable.
source ~/.bash_profile
You can use laravel directly in the command line. Try it.
laravel -V
If you can see the following, it means the operation is successful.
.
SOURCE ~/.bash_profile
You can use Laravel directly on the command line. Try it.
Laravel-v
If you can see the following, it means success.
Laravel Installer Version 1.2.1
2, create the project.
Laravel New Guagua
3. Configure Redis and queue.
4. Create Controller,
PHP Artisan Make:controller Defaultcontroller
Push100 a queue task in the Controller's action.
for ($i = 0; $i
5. Create Queue command
PHP
rights verification system. Open the./composer.json, change to: "Require": {"laravel/framework": "4.2.*", "Cartalyst/sentry": "2.1.4"}, then, Run the command composer update under the project root and wait a moment, it will prompt cartalyst/sentry 2.1.4 installation is complete. In the same vein, we will install a very powerful plugin for development, Way/generators, which is its name in the composer library. In COMPOSER.JSon added: "Require-dev": {"way/generators": "~2.0"}, and "require" sibli
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.