A method tutorial for writing the actual combat model of the Laravel framework project
This article mainly explains "the method tutorial of compiling the actual combat model of Laravel framework project". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn the method tutorial of writing the actual combat model of the Laravel framework project.
When developing a mvc project, models is the first step.
Let's start with modeling.
1. Entity relation diagram
Since I don't know what good modeling tools php has, I use the vs ado.net solid model data modeling here.
Let's start with laravel coding. Before coding, you have to configure the database connection in the app/config/database.php file.
'mysql' = > array (' driver' = > 'mysql',' read' = > array ('host' = >' 127.0.0.1 Vera 3306',), 'write' = > array (' host' = > '127.0.1 Vera 3306'), 'database' = >' test', 'username' = >' root', 'password' = >' root', 'charset' = >' utf8', 'collation' = >' utf8_unicode_ci', 'prefix' = >',)
Once configured, you need to use the artisan tool, which is a php command tool in the laravel directory
First of all, you need to establish a migration migrate through artisan, which is almost exactly the same as asp.net mvc
Right-click shfit+ in the laravel directory to open a command window and enter artisan migrate:make create_XXXX to generate a timestamped migration file under the app/database/migrations file.
Code: