Conditions | 1 |
Paths | 1 |
Total Lines | 35 |
Code Lines | 28 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
17 | public function up() |
||
18 | { |
||
19 | Schema::create('likes', function(Blueprint $table) { |
||
20 | $table->id(); |
||
21 | $table->morphs('likeable'); |
||
22 | $table->unsignedBigInteger('user_id')->index(); |
||
23 | $table->enum('type_id', [ |
||
24 | 'like', |
||
25 | 'dislike', |
||
26 | ])->default('like'); |
||
27 | $table->timestamps(); |
||
28 | |||
29 | $table->unique([ |
||
30 | 'likeable_id', |
||
31 | 'likeable_type', |
||
32 | 'user_id', |
||
33 | ], 'like_user_unique'); |
||
34 | |||
35 | }); |
||
36 | |||
37 | Schema::create('like_counters', function(Blueprint $table) { |
||
38 | $table->id(); |
||
39 | $table->morphs('likeable'); |
||
40 | $table->enum('type_id', [ |
||
41 | 'like', |
||
42 | 'dislike', |
||
43 | ])->default('like'); |
||
44 | $table->unsignedBigInteger('count')->default(0); |
||
45 | $table->timestamps(); |
||
46 | |||
47 | $table->unique([ |
||
48 | 'likeable_id', |
||
49 | 'likeable_type', |
||
50 | 'type_id', |
||
51 | ], 'like_counter_unique'); |
||
52 | }); |
||
67 |