日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

命令创建模型类

發布時間:2025/4/16 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 命令创建模型类 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
php artisan make:model Article php artisan make:model Page

?這樣,再在app目錄下就會有兩個文件Article.php?和Page.php.

接下來進行 Article 和 Page 類對應的 articles 表和 pages表的數據庫遷移,進入 learnlaravel5/databases/migrations 文件夾。

在 *createarticles_table.php 中修改:

Schema::create('articles', function(Blueprint $table) { $table->increments('id'); $table->string('title'); $table->string('slug')->nullable(); $table->text('body')->nullable(); $table->string('image')->nullable(); $table->integer('user_id'); $table->timestamps(); });

在 *createpages_table.php 中修改:

Schema::create('pages', function(Blueprint $table) { $table->increments('id'); $table->string('title'); $table->string('slug')->nullable(); $table->text('body')->nullable(); $table->integer('user_id'); $table->timestamps(); });

然后執行命令:

php artisan migrate

成功以后, tables 表和 pages 表已經出現在了數據庫里,去看看吧~

轉載于:https://www.cnblogs.com/yuwensong/p/4765965.html

總結

以上是生活随笔為你收集整理的命令创建模型类的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。