Conditions | 1 |
Paths | 1 |
Total Lines | 25 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
8 | public function up() |
||
9 | { |
||
10 | Schema::create('books', function (Blueprint $table) { |
||
11 | $table->increments('id'); |
||
12 | $table->unsignedInteger('author_id'); |
||
13 | $table->unsignedInteger('publisher_id'); |
||
14 | $table->timestamps(); |
||
15 | |||
16 | $table->text('description')->nullable(); |
||
17 | $table->dateTime('published_at'); |
||
18 | $table->string('title'); |
||
19 | $table->decimal('price')->default(0); |
||
20 | |||
21 | $table->foreign('author_id') |
||
22 | ->references('id') |
||
23 | ->on('authors') |
||
24 | ->onUpdate('CASCADE') |
||
25 | ->onDelete('CASCADE'); |
||
26 | $table->foreign('publisher_id') |
||
27 | ->references('id') |
||
28 | ->on('publishers') |
||
29 | ->onUpdate('CASCADE') |
||
30 | ->onDelete('CASCADE'); |
||
31 | }); |
||
32 | } |
||
33 | } |
||
34 |