03.12.2015 Views

laravel4cookbook

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

API 115<br />

1 public function up()<br />

2 {<br />

3 Schema::create('event', function(Blueprint $table) {<br />

4 $table->increments('id');<br />

5 $table->string('name');<br />

6 $table->text('description');<br />

7 $table->timestamp('started_at');<br />

8 $table->timestamp('ended_at');<br />

9 $table->timestamps();<br />

10 });<br />

11 }<br />

This was extracted from app/database/migrations/0000000000_0000000_create_event_table.php.<br />

.<br />

Similarly, we can create tables for sponsors and event categories:<br />

1 php artisan generate:migration --fields="name:string, description:text" create_ca\<br />

2 tegory_table<br />

3<br />

4 php artisan generate:migration --fields="name:string, url:string, description:tex\<br />

5 t" create_sponsor_table<br />

6 These commands generate the following migrations:<br />

1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!