欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

laravel使用命令行結(jié)合代碼創(chuàng)建數(shù)據(jù)表的方法

這篇文章主要介紹laravel使用命令行結(jié)合代碼創(chuàng)建數(shù)據(jù)表的方法,文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!

十余年的靈壽網(wǎng)站建設(shè)經(jīng)驗(yàn),針對(duì)設(shè)計(jì)、前端、開發(fā)、售后、文案、推廣等六對(duì)一服務(wù),響應(yīng)快,48小時(shí)及時(shí)工作處理。全網(wǎng)整合營(yíng)銷推廣的優(yōu)勢(shì)是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動(dòng)調(diào)整靈壽建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無(wú)論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計(jì),從而大程度地提升瀏覽體驗(yàn)。成都創(chuàng)新互聯(lián)從事“靈壽網(wǎng)站設(shè)計(jì)”,“靈壽網(wǎng)站推廣”以來(lái),每個(gè)客戶項(xiàng)目都認(rèn)真落實(shí)執(zhí)行。

雖然可以直接在數(shù)據(jù)庫(kù)中創(chuàng)建數(shù)據(jù)表,但是不便于以后項(xiàng)目的遷移。現(xiàn)使用命令行結(jié)合代碼的方式來(lái)進(jìn)行生成。

1、通過(guò)命令創(chuàng)建數(shù)據(jù)表文件
php artisan make:migration create_table_customers

laravel使用命令行結(jié)合代碼創(chuàng)建數(shù)據(jù)表的方法

2、在數(shù)據(jù)表文件中完善數(shù)據(jù)表相關(guān)字段
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateTableCustomers extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('customers', function (Blueprint $table) {
            $table->increments('id');
            $table->string('mobile')->nullable()->unique();
            $table->string('email')->unique();
            $table->string('website')->default('website')->comment('站點(diǎn):applet、website');
            $table->string('store_id')->default('1')->comment('店鋪 ID');
            $table->string('first_name');
            $table->string('last_name');
            $table->integer('appellation')->comment('稱謂');
            $table->dateTime('birthday')->comment('生日');
            $table->string('province')->comment('省');
            $table->string('city')->comment('市');
            $table->string('district')->comment('區(qū)/縣');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('customers');
    }
}

laravel使用命令行結(jié)合代碼創(chuàng)建數(shù)據(jù)表的方法

3、生成數(shù)據(jù)表
php artisan migrate

laravel使用命令行結(jié)合代碼創(chuàng)建數(shù)據(jù)表的方法

laravel使用命令行結(jié)合代碼創(chuàng)建數(shù)據(jù)表的方法

以上是“l(fā)aravel使用命令行結(jié)合代碼創(chuàng)建數(shù)據(jù)表的方法”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對(duì)大家有幫助,更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!

分享名稱:laravel使用命令行結(jié)合代碼創(chuàng)建數(shù)據(jù)表的方法
當(dāng)前URL:http://www.chinadenli.net/article34/ippgse.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供靜態(tài)網(wǎng)站小程序開發(fā)云服務(wù)器虛擬主機(jī)ChatGPT移動(dòng)網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

商城網(wǎng)站建設(shè)