File tree Expand file tree Collapse file tree 2 files changed +16
-15
lines changed
Expand file tree Collapse file tree 2 files changed +16
-15
lines changed Original file line number Diff line number Diff line change 22
33return [
44 /*
5- * Contacts
5+ * Followers
66 */
77 'follower ' => [
88 /*
99 * Relationship table for followers and followables
1010 */
11- 'table ' => 'followables ' ,
11+ 'table ' => 'followers ' ,
1212
1313 /*
1414 * Cache follower/following counts
Original file line number Diff line number Diff line change 33use Illuminate\Database\Schema\Blueprint;
44use Illuminate\Database\Migrations\Migration;
55
6- class FollowersTable extends Migration
6+ /**
7+ * Class CreateFollowersTable
8+ */
9+ class CreateFollowersTable extends Migration
710{
811 /**
9- * Table name
12+ * Table names.
13+ *
14+ * @var string $table The main table name for this migration.
1015 */
11- private $table;
16+ protected $table;
1217
1318 /**
14- * Constructor
19+ * Create a new migration instance.
1520 */
1621 public function __construct()
1722 {
18- $this->table = config('lecturize.followers.table', 'followables ');
23+ $this->table = config('lecturize.followers.table', 'followers ');
1924 }
2025
2126 /**
@@ -29,11 +34,8 @@ class FollowersTable extends Migration
2934 {
3035 $table->increments('id');
3136
32- $table->integer('follower_id')->unsigned()->index();
33- $table->string('follower_type');
34-
35- $table->integer('followable_id')->unsigned()->index();
36- $table->string('followable_type');
37+ $table->nullableMorphs('follower');
38+ $table->nullableMorphs('followable');
3739
3840 $table->timestamps();
3941 $table->softDeletes();
@@ -47,7 +49,6 @@ class FollowersTable extends Migration
4749 */
4850 public function down()
4951 {
50- Schema::drop ($this->table);
52+ Schema::dropIfExists ($this->table);
5153 }
52- }
53-
54+ }
You can’t perform that action at this time.
0 commit comments