Simultaneous release: HTTP://EKAN001.COM/ARTICLE/26 ConfigurationThere is no introduction to the definition of the queue. We have two keys to using an asynchronous queue: 1.存储队列的地方2.执行任务的服务 Open config/queue.php , this is Laravel5 about the queue configuration file. First we can default specify the default queue driver by the parameter, the default configuration is sync , this is the synchronization queue, we want to do the asynchronous queue first change here. Assuming that we are using databas
to configure the image of the classmate, you can use the Laravel realm very famous Ang Sul to engage in the installation artifact: Https://github.com/overtrue/latest-laravel
3. Database Setup and Migration
Laravel 5 Change the location of the database configuration to ' learnlaravel5/.env ', open this file, edit the following four items and modify it to the correct information:
Db_host=localhostdb_database=laravel5db_username=rootdb_password=password
It is recommended to create a new database n
Laravel 5 framework learning-database migration (Migrations), laravelmigrations
Database migrations is one of laravel's most powerful functions. Database migration can be understood as the version controller of the database.
The database/migrations directory contains two migration files, one for creating a user table and the other for resetting the user password.
In the migration file, the up method is used to create a data table, and the down method is used to roll back the data table, that is,
1. Introduction
Laravel contains a simple way to populate a database-using fill classes and test data. All fill classes are located in the Database/seeds directory. The class name of the fill class is completely customizable, but it's best to follow certain rules, such as readability, such as Usertableseeder, and so on. When Laravel is installed, a Databaseseeder class is provided by default. From this class, you can use the call method to run other fill classes, allowing you to control the fil
Premise: This method is to use Linux crontab timed tasks to help implement Laravel scheduling (Mac also).First, add crontab scheduled Tasks, here only to do a brief introduction.Add the following with the command crontab-e/usr/local/bin/php /usr/local/var/www/projectName/artisan schedule:run >> /dev/null 2>1
1
2
:The above command crontab every minute to tune the Laravel Schedule command, and then laravel judgment to perform the task
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 migrat
Introduction
Writing seeders
Using Model Factories
Calling Additional Seeders
Running seeders
IntroductionLaravel includes a simple method of the seeding your database with test data using seed classes. All seed classes is stored in database/seeds . Seed classes May has any name of wish, but probably should follow some sensible convention, such as UserTableSeeder , etc. By default, a-class is defined for you DatabaseSeeder . From this class, you may use the c
This article mainly summarizes and introduces the precautions for using phpartisanmigrate in laravel5.1. This article is very detailed and has some reference and learning value for you to use phpartisanmigrate, let's take a look. This article mainly summarizes the precautions for using php artisan migrate in laravel 5.1. This article is very detailed and has some reference and learning value for you to use php art
->collapse()->toArray());
Focus on$this->getCachedServicesPath()Through the source code, Laravel determines how to register ServiceProvider Based on the bootstrap/cache/services. php file.
Now I thought about why I commented out //protected $defer = true; The reason why the code is still invalid.
So in order to make//protected $defer = true; Code execution is required
php artisan clear-compiled php artisan
{ /** * Register any application services. * * @return void */ public function register() { if ($this->app->environment('local', 'testing', 'staging')) { $this->app->register(DuskServiceProvider::class); } }}
Next we will installDUSK#
php artisan dusk:install
browse(function ($browser) { $browser->visit('/') ->assertSee('Laravel'); }); }
Note: You ne
... Right-click menu to install [Laravel 5 IDE Helper Generator] to our project. Search for Barryvdh/laravel-ide-helper, and click Install to download and add to the project.
Self-help Way
Because we are using it in the project, we add this feature to the project and add the Require-dev branch to the Composer.jsonLaravel 4.*, the version here should be filled in 1.*
"Require-dev": { //... " Barryvdh/laravel-ide-helper ":" 2.* " //...},
Then use the command composer UPDATE-VVV to update the
This article mainly introduced the Laravel Event System Usage Summary, has certain reference value, now shares to everybody, has the need friend can refer to
The Laravel event provides a simple observer implementation that subscribes to and listens to various events that occur in the application. The event classes are saved in the App/events directory, and the listeners for these events are saved in the App/listeners directory. These directories are created automatically only when you use the
This article mainly introduces laravel5.2's method for distinguishing between frontend and backend user logon. it is very good and has reference value. if you need it, refer to section 1. frontend logon.
Directly use the auth provided by laravel
php artisan make:auth
Then you can view the route file:
Route::group(['middleware' => 'web'], function () { Route::auth(); Route::get('/home', 'HomeController@index');});
Execute php
This article mainly introduces about the Laravel5.5+homestead environment + build the basic framework, has a certain reference value, now share to everyone, the need for friends can refer to
First, build the Project Foundation framework: (front-end separation write API interface)
1. Download and install Laravel5;
Command line:composer Create-project Laravel/laravel project name --prefer-dist "5.5.*"
2, install the application key;
2.1, will .env.example file renamed. env Configure data
around resources, for example, you might want to create a controller in your app that handles HTTP requests for picture storage, Make:controller with the Artisan command, We can quickly create such a controller:Of course, we'll talk to you in detail. Use of artisan toolsPHP Artisan Make:controller PhotocontrollerThe Artisan
[IntermediateLaravel] 9-Database-Seeding-and-Model-Factories
Generally, when setting up an application, we need to insert some simple data. what should we do? the conclusion is to run the Database-Seeding function.Database-Seeding data filling
By default, database \ seeds \ only has a single DatabaseSeeder. php. we create the UsersTableSeeder. php class:
Class UsersTableSeeder extends Seeder {/*** Run the database seeds. ** @ return void */public function run () {// You can also use App \ Use
,created_at,updated_at) VALUES (?,?,?,?) ', [' article-title2 ', ' Article-content2 ', \carbon\carbon::now (), \carbon\carbon::now ()] ); }
Then run the command in the directory PHP artisan db:seed If not prompted, then go to the database table to see it, a record is thus generated;
To generate multiple records at the same time, you can add multipl
? Here you have three options:
Use a server that comes with PHP
Go to the corresponding directory of the project CD blog/, open the PHP server:
Php-s localhost:8999-t Public
Then visit localhost:8999 to see the first page of Laravel:
Using artisan
Still under the blog/directory, the command line executes:
PHP Artisan Serve
Then visit localhost:8000, you can also see the corresponding laravel defau
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.