H
H
HeartOfProgrammer2016-02-23 22:57:36
Laravel
HeartOfProgrammer, 2016-02-23 22:57:36

Why can't laravel create a table?

Terminal gives me this error when I try to create
67a6d88f758b4472998dc256c0a1153d.png
my migration table:

class CreateBooksTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('books', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title');
            $table->text('description');
            $table->string('author');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('books');
    }
}

My Book Model:
class Book extends Model
{
    protected $table = 'books';
    protected $fillable = [
        'title',
        'description',
        'author'
    ];
}

Where did I make a mistake?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Pochepko, 2016-02-23
@HeartOfProgrammer

Schema::create('books', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title');
            $table->text('description');
            $table->string('author');
            $table->timestamps();
        });

create method. And the table method refers to an existing table.
PS Read the text of errors. Everything is written there

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question