'how to fix “Method Illuminate\Database\Schema\Blueprint::number does not exist.”
When I use php artisan migrate I receive this message. Can someone help me with this? I searched on the Internet but I didn't find anything that helped me. (I am new in laravel)
My Table:
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateSroomsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('srooms', function (Blueprint $table) {
$table->id();
$table->string('room_two');
$table->string('room_three');
$table->string('room_four');
$table->string('room_five');
$table->string('room_six');
$table->string('room_seven');
$table->string('room_eight');
$table->string('room_nine');
$table->string('room_ten');
$table->string('room_eleven');
$table->string('room_twelve');
$table->softDeletes();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('srooms');
}
}`
Solution 1:[1]
You declared a column as a number like:
[$table->number('')]
but you should use
[$table->integer('')]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Jeremy Caney |