前提・実現したいこと
laravelとvue.jsでポートフォリオを作成しています。migrationをしたいのですが、エラーが出てしまいます。
以前はできていましたがデプロイを行ってから何故かできなくなってしまいました。
発生している問題・エラーメッセージ
root@c59ef3e3d59a:/work/backend# php artisan migrate BadMethodCallException : Method Illuminate\Database\Schema\Blueprint::string does not exist. at /work/backend/vendor/laravel/framework/src/Illuminate/Support/Traits/Macroable.php:103 99| */ 100| public function __call($method, $parameters) 101| { 102| if (! static::hasMacro($method)) { > 103| throw new BadMethodCallException(sprintf( 104| 'Method %s::%s does not exist.', static::class, $method 105| )); 106| } 107| Exception trace: 1 Illuminate\Database\Schema\Blueprint::__call("string") /work/backend/vendor/laravel/framework/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php:155 2 Illuminate\Database\Migrations\DatabaseMigrationRepository::Illuminate\Database\Migrations\{closure}(Object(Illuminate\Database\Schema\Blueprint)) /work/backend/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php:166 Please use the argument -v to see more details.
該当のソースコード
####マイグレーションファイル
php
1<?php 2 3use Illuminate\Database\Migrations\Migration; 4use Illuminate\Database\Schema\Blueprint; 5use Illuminate\Support\Facades\Schema; 6use Illuminate\Validation\Rules\Unique; 7 8class CreateUsersTable extends Migration 9{ 10 /** 11 * Run the migrations. 12 * 13 * @return void 14 */ 15 public function up() 16 { 17 Schema::create('users', function (Blueprint $table) { 18 $table->bigIncrements('id'); 19 $table->string('name')->unique(); 20 $table->string('email')->unique(); 21 $table->timestamp('email_verified_at')->nullable(); 22 $table->string('password')->nullable(); 23 $table->rememberToken(); 24 $table->timestamps(); 25 }); 26 } 27 28 /** 29 * Reverse the migrations. 30 * 31 * @return void 32 */ 33 public function down() 34 { 35 Schema::dropIfExists('users'); 36 } 37} 38
php
1<?php 2 3use Illuminate\Database\Migrations\Migration; 4use Illuminate\Database\Schema\Blueprint; 5use Illuminate\Support\Facades\Schema; 6 7class CreateQuestionsTable extends Migration 8{ 9 /** 10 * Run the migrations. 11 * 12 * @return void 13 */ 14 public function up() 15 { 16 Schema::create('questions', function (Blueprint $table) { 17 $table->bigIncrements('id'); 18 $table->text('title'); 19 $table->text('body'); 20 $table->boolean('solution')->default(false); 21 $table->bigInteger('user_id'); 22 $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); 23 $table->timestamps(); 24 }); 25 } 26 27 /** 28 * Reverse the migrations. 29 * 30 * @return void 31 */ 32 public function down() 33 { 34 Schema::dropIfExists('questions'); 35 } 36} 37
php
1<?php 2 3use Illuminate\Database\Migrations\Migration; 4use Illuminate\Database\Schema\Blueprint; 5use Illuminate\Support\Facades\Schema; 6 7class CreateAnswersTable extends Migration 8{ 9 /** 10 * Run the migrations. 11 * 12 * @return void 13 */ 14 public function up() 15 { 16 Schema::create('answers', function (Blueprint $table) { 17 $table->bigIncrements('id'); 18 $table->text('body'); 19 $table->bigInteger('user_id'); 20 $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); 21 $table->bigInteger('question_id'); 22 $table->foreign('question_id')->references('id')->on('questions')->onDelete('cascade'); 23 $table->timestamps(); 24 }); 25 } 26 27 /** 28 * Reverse the migrations. 29 * 30 * @return void 31 */ 32 public function down() 33 { 34 Schema::dropIfExists('answers'); 35 } 36} 37
php
1<?php 2 3use Illuminate\Database\Migrations\Migration; 4use Illuminate\Database\Schema\Blueprint; 5use Illuminate\Support\Facades\Schema; 6 7class CreateSympathiesTable extends Migration 8{ 9 /** 10 * Run the migrations. 11 * 12 * @return void 13 */ 14 public function up() 15 { 16 Schema::create('likes', function (Blueprint $table) { 17 $table->bigIncrements('id'); 18 $table->bigInteger('user_id'); 19 $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); 20 $table->bigInteger('question_id'); 21 $table->foreign('question_id')->references('id')->on('questions')->onDelete('cascade'); 22 $table->timestamps(); 23 }); 24 } 25 26 /** 27 * Reverse the migrations. 28 * 29 * @return void 30 */ 31 public function down() 32 { 33 Schema::dropIfExists('sympathies'); 34 } 35} 36
試したこと
php artisan migrate:refreshの実行
AppServiceProviderのboolの編集
タイプミスの確認(一つずつ打ち直しました)
php artisan config:cacheの実行
補足情報(FW/ツールのバージョンなど)
laravel 6.20.37
PHP 8.0.13
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。