我得到的错误是
“Illuminate\Database\QueryException:SQLSTATE[42S22]:未找到列:1054 ‘where 子句’中的未知列‘key’(SQL:从其中选择 *!=admin_settings空key限制 1)”
因为函数在app/Providers/AppServiceProvider.php
public function boot()
{
if (Schema::hasTable('admin_settings')) {
$google_analytics_details = AdminSetting::where('key','!=','null')->first();
}else {
$google_analytics_details = '';
}
View::share('google_analytics_details', $google_analytics_details);
}
当我评论引导功能的代码时,它就成功迁移了。
我正在寻找此视图共享的替代方案。谁能帮我??
我的迁移文件内容:
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateAdminSettingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::table('admin_settings', function (Blueprint $table) {
$table->dropColumn('google_analytics_code');
});
Schema::table('admin_settings', function (Blueprint $table) {
$table->longText('key')->nullable()->after('id');
$table->longText('value')->nullable()->after('key');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::table('admin_settings', function (Blueprint $table) {
});
}
}
ABOUTYOU