Neethu Ah's avatar

Blueprint could not be converted to string

When i try to migration run got " Object of class Illuminate\Database\Schema\Blueprint could not be converted to string" error . Why this shows .

Object of class Illuminate\Database\Schema\Blueprint could not be converted to string

at C:\Users\Admin\Desktop\servicemaster\database\migrations\2021_11_17_134631_create_stocktransfers_table.php:18 14▕ public function up() 15▕ { 16▕ Schema::create('stocktransfers', function (Blueprint $table) { 17▕ $table->id(); ➜ 18▕ $table->$table->string('warehouse'); 19▕ $table->$table->string('shop'); 20▕ $table->$table->string('product'); 21▕ $table->smallInteger('quantity'); 22▕ $table->date('transferdate');

1 C:\Users\Admin\Desktop\servicemaster\vendor\laravel\framework\src\Illuminate\Database\Schema\Builder.php:227 CreateStocktransfersTable::{closure}(Object(Illuminate\Database\Schema\Blueprint))

2 C:\Users\Admin\Desktop\servicemaster\vendor\laravel\framework\src\Illuminate\Support\helpers.php:263 Illum

//********************* Migration Code

0 likes
1 reply
idew's avatar

It could be that in a couple cases you are trying to reference $table on $table. You should not call $table->$table. For example, $table->$table->string('shop') should just be $table->string('shop').

1 like

Please or to participate in this conversation.