Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

A method tutorial for writing the actual combat model of the Laravel framework project

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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:

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report