Passed
Push — master ( 7acdf2...feb473 )
by Georgi
02:32
created
Access/Database/Migrations/2019_10_24_195050_create_permission_tables.php 2 patches
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -6,97 +6,97 @@
 block discarded – undo
6 6
 
7 7
 class CreatePermissionTables extends Migration
8 8
 {
9
-    /**
10
-     * Run the migrations.
11
-     *
12
-     * @return void
13
-     */
14
-    public function up()
15
-    {
16
-        $tableNames = config('permission.table_names');
17
-        $columnNames = config('permission.column_names');
18
-
19
-        Schema::create($tableNames['permissions'], function (Blueprint $table) {
20
-            $table->bigIncrements('id');
21
-            $table->string('name');
22
-            $table->string('guard_name');
23
-            $table->timestamps();
24
-        });
25
-
26
-        Schema::create($tableNames['roles'], function (Blueprint $table) {
27
-            $table->bigIncrements('id');
28
-            $table->string('name');
29
-            $table->string('guard_name');
30
-            $table->timestamps();
31
-        });
32
-
33
-        Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames) {
34
-            $table->unsignedBigInteger('permission_id');
35
-
36
-            $table->string('model_type');
37
-            $table->unsignedBigInteger($columnNames['model_morph_key']);
38
-            $table->index([$columnNames['model_morph_key'], 'model_type', ], 'model_has_permissions_model_id_model_type_index');
39
-
40
-            $table->foreign('permission_id')
41
-                ->references('id')
42
-                ->on($tableNames['permissions'])
43
-                ->onDelete('cascade');
44
-
45
-            $table->primary(['permission_id', $columnNames['model_morph_key'], 'model_type'],
46
-                    'model_has_permissions_permission_model_type_primary');
47
-        });
48
-
49
-        Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames) {
50
-            $table->unsignedBigInteger('role_id');
51
-
52
-            $table->string('model_type');
53
-            $table->unsignedBigInteger($columnNames['model_morph_key']);
54
-            $table->index([$columnNames['model_morph_key'], 'model_type', ], 'model_has_roles_model_id_model_type_index');
55
-
56
-            $table->foreign('role_id')
57
-                ->references('id')
58
-                ->on($tableNames['roles'])
59
-                ->onDelete('cascade');
60
-
61
-            $table->primary(['role_id', $columnNames['model_morph_key'], 'model_type'],
62
-                    'model_has_roles_role_model_type_primary');
63
-        });
64
-
65
-        Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) {
66
-            $table->unsignedBigInteger('permission_id');
67
-            $table->unsignedBigInteger('role_id');
68
-
69
-            $table->foreign('permission_id')
70
-                ->references('id')
71
-                ->on($tableNames['permissions'])
72
-                ->onDelete('cascade');
73
-
74
-            $table->foreign('role_id')
75
-                ->references('id')
76
-                ->on($tableNames['roles'])
77
-                ->onDelete('cascade');
78
-
79
-            $table->primary(['permission_id', 'role_id'], 'role_has_permissions_permission_id_role_id_primary');
80
-        });
81
-
82
-        app('cache')
83
-            ->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null)
84
-            ->forget(config('permission.cache.key'));
85
-    }
86
-
87
-    /**
88
-     * Reverse the migrations.
89
-     *
90
-     * @return void
91
-     */
92
-    public function down()
93
-    {
94
-        $tableNames = config('permission.table_names');
95
-
96
-        Schema::drop($tableNames['role_has_permissions']);
97
-        Schema::drop($tableNames['model_has_roles']);
98
-        Schema::drop($tableNames['model_has_permissions']);
99
-        Schema::drop($tableNames['roles']);
100
-        Schema::drop($tableNames['permissions']);
101
-    }
9
+	/**
10
+	 * Run the migrations.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function up()
15
+	{
16
+		$tableNames = config('permission.table_names');
17
+		$columnNames = config('permission.column_names');
18
+
19
+		Schema::create($tableNames['permissions'], function (Blueprint $table) {
20
+			$table->bigIncrements('id');
21
+			$table->string('name');
22
+			$table->string('guard_name');
23
+			$table->timestamps();
24
+		});
25
+
26
+		Schema::create($tableNames['roles'], function (Blueprint $table) {
27
+			$table->bigIncrements('id');
28
+			$table->string('name');
29
+			$table->string('guard_name');
30
+			$table->timestamps();
31
+		});
32
+
33
+		Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames) {
34
+			$table->unsignedBigInteger('permission_id');
35
+
36
+			$table->string('model_type');
37
+			$table->unsignedBigInteger($columnNames['model_morph_key']);
38
+			$table->index([$columnNames['model_morph_key'], 'model_type', ], 'model_has_permissions_model_id_model_type_index');
39
+
40
+			$table->foreign('permission_id')
41
+				->references('id')
42
+				->on($tableNames['permissions'])
43
+				->onDelete('cascade');
44
+
45
+			$table->primary(['permission_id', $columnNames['model_morph_key'], 'model_type'],
46
+					'model_has_permissions_permission_model_type_primary');
47
+		});
48
+
49
+		Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames) {
50
+			$table->unsignedBigInteger('role_id');
51
+
52
+			$table->string('model_type');
53
+			$table->unsignedBigInteger($columnNames['model_morph_key']);
54
+			$table->index([$columnNames['model_morph_key'], 'model_type', ], 'model_has_roles_model_id_model_type_index');
55
+
56
+			$table->foreign('role_id')
57
+				->references('id')
58
+				->on($tableNames['roles'])
59
+				->onDelete('cascade');
60
+
61
+			$table->primary(['role_id', $columnNames['model_morph_key'], 'model_type'],
62
+					'model_has_roles_role_model_type_primary');
63
+		});
64
+
65
+		Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) {
66
+			$table->unsignedBigInteger('permission_id');
67
+			$table->unsignedBigInteger('role_id');
68
+
69
+			$table->foreign('permission_id')
70
+				->references('id')
71
+				->on($tableNames['permissions'])
72
+				->onDelete('cascade');
73
+
74
+			$table->foreign('role_id')
75
+				->references('id')
76
+				->on($tableNames['roles'])
77
+				->onDelete('cascade');
78
+
79
+			$table->primary(['permission_id', 'role_id'], 'role_has_permissions_permission_id_role_id_primary');
80
+		});
81
+
82
+		app('cache')
83
+			->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null)
84
+			->forget(config('permission.cache.key'));
85
+	}
86
+
87
+	/**
88
+	 * Reverse the migrations.
89
+	 *
90
+	 * @return void
91
+	 */
92
+	public function down()
93
+	{
94
+		$tableNames = config('permission.table_names');
95
+
96
+		Schema::drop($tableNames['role_has_permissions']);
97
+		Schema::drop($tableNames['model_has_roles']);
98
+		Schema::drop($tableNames['model_has_permissions']);
99
+		Schema::drop($tableNames['roles']);
100
+		Schema::drop($tableNames['permissions']);
101
+	}
102 102
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,21 +16,21 @@  discard block
 block discarded – undo
16 16
         $tableNames = config('permission.table_names');
17 17
         $columnNames = config('permission.column_names');
18 18
 
19
-        Schema::create($tableNames['permissions'], function (Blueprint $table) {
19
+        Schema::create($tableNames['permissions'], function(Blueprint $table) {
20 20
             $table->bigIncrements('id');
21 21
             $table->string('name');
22 22
             $table->string('guard_name');
23 23
             $table->timestamps();
24 24
         });
25 25
 
26
-        Schema::create($tableNames['roles'], function (Blueprint $table) {
26
+        Schema::create($tableNames['roles'], function(Blueprint $table) {
27 27
             $table->bigIncrements('id');
28 28
             $table->string('name');
29 29
             $table->string('guard_name');
30 30
             $table->timestamps();
31 31
         });
32 32
 
33
-        Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames) {
33
+        Schema::create($tableNames['model_has_permissions'], function(Blueprint $table) use ($tableNames, $columnNames) {
34 34
             $table->unsignedBigInteger('permission_id');
35 35
 
36 36
             $table->string('model_type');
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
                     'model_has_permissions_permission_model_type_primary');
47 47
         });
48 48
 
49
-        Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames) {
49
+        Schema::create($tableNames['model_has_roles'], function(Blueprint $table) use ($tableNames, $columnNames) {
50 50
             $table->unsignedBigInteger('role_id');
51 51
 
52 52
             $table->string('model_type');
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
                     'model_has_roles_role_model_type_primary');
63 63
         });
64 64
 
65
-        Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) {
65
+        Schema::create($tableNames['role_has_permissions'], function(Blueprint $table) use ($tableNames) {
66 66
             $table->unsignedBigInteger('permission_id');
67 67
             $table->unsignedBigInteger('role_id');
68 68
 
Please login to merge, or discard this patch.