你的觀點(diǎn)是混亂的。首先添加表單操作然后添加按鈕表單屬性,如下所示:<button type="submit" form="upload" class="btn btn-info pull-right" id="submit" data-loading-text='SOME TEXT'> Please wait<?php echo $this->lang->line('save'); ?></button><form id="upload" role="form" method="post" class="ptt10" enctype="multipart/form-data" action="upload_docs">分享703507 703507 703507 我試圖在 laraval 5.8 中使用 php artisan migrate 命令更改我的 char 類型列默認(rèn)值,但出現(xiàn)以下錯(cuò)誤:Unknown column type "char" requested. Any Doctrine type that you use has to be registered with \Doctrine\DBAL\Types\Type::addType(). You can get a list of all the known types with \Doctrine\DBAL\Types\Type::getTypesMap(). If this error occurs during database introspection then you might have forgotten to register all database types for a Doctrine Type. Use AbstractPlatform#registerDoctrineTypeMapping() or have your custom types implement Type#getMappedDatabaseTypes(). If the type name is empty you might have a problem with the cache or forgot some mapping information.我當(dāng)前的腳本如下:use Illuminate\Support\Facades\Schema;use Illuminate\Database\Schema\Blueprint;use Illuminate\Database\Migrations\Migration;class AddTypeDeafultValueProjectsTable extends Migration{/** * Run the migrations. * * @return void */public function up(){ Schema::table('projects', function (Blueprint $table) { $table->char('type', 50)->nullable(true)->change(); });}/** * Reverse the migrations. * * @return void */public function down(){ Schema::table('projects', function (Blueprint $table) { // });}}我沒有遇到其他數(shù)據(jù)類型列的問題,但僅針對(duì) char 出現(xiàn)上述錯(cuò)誤。可以幫我解決這個(gè)問題嗎?PHP數(shù)據(jù)庫(kù)拉維laravel-5
1 回答

白衣染霜花
TA貢獻(xiàn)1796條經(jīng)驗(yàn) 獲得超10個(gè)贊
您需要在遷移腳本中添加以下腳本:
在 use Illuminate\Database\Migrations\Migration 下或之上添加以下內(nèi)容;
use Doctrine\DBAL\Types\StringType; use Doctrine\DBAL\Types\Type;
之后在 inside up 函數(shù)中添加以下腳本并再次嘗試 php artisan migrate。
if (!Type::hasType('char')) { Type::addType('char', StringType::class); }
- 1 回答
- 0 關(guān)注
- 128 瀏覽
添加回答
舉報(bào)
0/150
提交
取消