Ad
Why Does Php Artisan Create Migration Class With Empty Up Method?
I am currently learning from this video
https://laracasts.com/series/laravel-from-scratch-2018/episodes/7
about database migrations in laravel. I typed in console :
php artisan make:migration create_projects_table
just like the teacher in the video and somehow I get an empty method definition in the migrations folder.
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateProjectsTable extends Migration
{
public function up()
{
//should contain Schema::create but it is empty
}
public function down()
{
}
}
What did I do wrong? I followed all those instructions in the video.
Ad
Answer
php artisan make:migration create_projects_table --create=projects
edit: It should indeed work without adding the argument: https://github.com/laravel/framework/blob/854e6d1d001f5e9a6d1376d2284eaa99b0c1e443/src/Illuminate/Database/Console/Migrations/MigrateMakeCommand.php#L88
// Next, we will attempt to guess the table name if this the migration has
// "create" in the name. This will allow us to provide a convenient way
// of creating migrations that create new tables for the application.
if (! $table) {
[$table, $create] = TableGuesser::guess($name);
}
Here you can see that your tables name should match (\w+)
pattern
Ad
source: stackoverflow.com
Related Questions
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
Ad