Skip to content

Commit daed833

Browse files
Fix table names
1 parent 57e6d29 commit daed833

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

config/config.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
return [
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

database/migrations/create_followers_table.php.stub

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,24 @@
33
use Illuminate\Database\Schema\Blueprint;
44
use 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+
}

0 commit comments

Comments
 (0)