Support the ongoing development of Laravel.io →
posted 8 years ago
Database
Last updated 2 years ago.
0

You can check if a table exists with

if (Schema::hasTable('todos'))
{
    //
}

When creating a table, don't use Schema::table but do the following:

Schema::create('todos', function($table)
{
    $table->increments('id');
});

Also use the artisan command to create migrations

php artisan make:migration create_todo_table --create=todos

use the --table option if you want to create a migration to alter a table

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.