Support the ongoing development of Laravel.io →
Configuration Database

From the Starting with Laravel 4 book I have two models files named Cat.php and Breed.php in my models folder.

<?php class Cat extends Eloquent { protected $fillable = array('name', 'date_of_birth', 'breed_id'); public function getDates() { return array('date_of_birth', 'created_at', 'updated_at'); } public function breed(){ return $this->belongsTo('Breed'); } } ======================================= <?php class Breed extends Eloquent { public $timestamps = false; public function cats(){ return $this->hasMany('Cat'); } } ====================================================== when I run php artisan migrate:make add_cats_and_breeds_table it only creates this skeleton migration file ================================================== <?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class AddCatsAndBreedsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { // } /** * Reverse the migrations. * * @return void */ public function down() { // } } ========================================================= the Schema::create................ and all the $table-> lines are missing.. Any thoughts? There should be
Last updated 3 years ago.
0

The Artisan migrate:make command is designed to create the skeleton file for you, so that you can then add in the required fields easily.

Migrate:make accepts two parameters that alter what is created:

--create=table_name

Adds the code for creating a new schema called 'table_name'.

--table=table_name

Adds the code to define the table name.

Neither does anything more complicated than that. Migrate can't infer the structure of the table - you have to define the columns and their properties manually within the up() function. Using --create and --table grants you a shortcut in writing in the names and create syntax.

Last updated 3 years ago.
0

I greatly appreciate your timely response kwaanonline. Thank you.

Now I can move forward

Last updated 3 years ago.
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.

© 2025 Laravel.io - All rights reserved.