OauthIdentitiesTable::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
6
class OauthIdentitiesTable extends Migration
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
7
{
8
    /**
9
     * The authentication service providers table name.
10
     *
11
     * @var string
12
     */
13
    protected $authenticationProvidersTable;
14
    /**
15
     * The users table name.
16
     *
17
     * @var string
18
     */
19
    protected $usersTable;
20
21
    /**
22
     * CreateOauthIdentitiesTable constructor.
23
     */
24
    public function __construct()
25
    {
26
        $this->authenticationProvidersTable = Config::get('laraveltube-socialite.table');
27
    }
28
29
    /**
30
     * Run the migrations.
31
     *
32
     * @return void
33
     */
34
    public function up()
35
    {
36
        Schema::create($this->authenticationProvidersTable, function (Blueprint $table) {
37
            $table->increments('id');
38
            $table->integer('user_id')->unsigned();
39
            $table->foreign('user_id')->references('id')->on('users')
40
                ->onDelete('cascade')
41
                ->onUpdate('cascade');
42
            $table->string('provider_user_id');
43
            $table->string('provider');
44
            $table->string('access_token');
45
            $table->string('avatar');
46
            $table->string('name')->nullable();
47
            $table->string('nickname')->nullable();
48
            $table->timestamps();
49
        });
50
    }
51
52
    /**
53
     * Reverse the migrations.
54
     *
55
     * @return void
56
     */
57
    public function down()
58
    {
59
        Schema::table($this->authenticationProvidersTable, function (Blueprint $table) {
60
            $table->dropForeign('oauth_identities_user_id_foreign');
61
        });
62
        Schema::drop($this->authenticationProvidersTable);
63
    }
64
}
65