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

How Laravel creates the specified table migrate

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Most people do not understand the knowledge points of this article "Laravel how to create a designated table migrate", so the editor summarizes the following contents, detailed contents, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "Laravel how to create a designated table migrate" article.

The sample code is as follows:

To do this, you need to set the automatic loading in composer.json and load the files under the folder database/migrations:

.... "autoload": {"classmap": ["database/seeds", "database/migrations", "database/factories"],.... PS D:\ phpStudy\ WWW\ BCCAdminV1.0 > php artisan tinkerPsy Shell v0.7.2 (PHP 7.1.9-cli) by Justin Hileman > (new CreateAccessLogsTable)-> up (); = > null >

Running a null, I thought it would be finished, but I still went to the database to have a look, and guess what, it really worked!

Public function up () {/ / Schema::dropIfExists ('users'); Schema::create (' access_logs', function (Blueprint $table) {$table- > increments ('id'); $table- > string (' ip')-> default ('0')-> comment ('ip address'); $table- > integer ('customer_id')-> default (' 0')-> comment ('user ID') $table- > string ('refer_website')-> default ('')-> comment ('Source website'); $table- > string ('broswer')-> default ('')-> comment ('client browser'); $table- > string ('operating_system')-> default (')-> comment ('client operating system'); $table- > string ('resolution')-> default ('')-> comment ('client Resolution') $table- > string ('visited_page')-> default ('')-> comment ('visited page'); $table- > timestamp ('created_at'); $table- > timestamp (' left_at');}) } the above is the content of this article on "how to create a designated table migrate for Laravel". I believe you all have some understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.

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