Completed
Push — master ( 2da897...c93f74 )
by Sherif
03:39
created

UsersTableSeeder::run()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 116
Code Lines 68

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 116
rs 8.2857
c 0
b 0
f 0
cc 1
eloc 68
nc 1
nop 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace App\Modules\V1\Acl\Database\Seeds;
4
5
use Illuminate\Database\Seeder;
6
7
class UsersTableSeeder extends Seeder
8
{
9
    /**
10
     * Run the database seeds.
11
     *
12
     * @return void
13
     */
14
    public function run()
15
    {
16
    	/**
17
         * Insert the permissions related to users table.
18
         */
19
        \DB::table('permissions')->insert(
20
        	[
21
        		/**
22
        		 * Users model permissions.
23
        		 */
24
	        	[
25
	        	'name'       => 'save',
26
	        	'model'      => 'users',
27
	        	'created_at' => \DB::raw('NOW()'),
28
	        	'updated_at' => \DB::raw('NOW()')
29
	        	],
30
	        	[
31
	        	'name'       => 'delete',
32
	        	'model'      => 'users',
33
	        	'created_at' => \DB::raw('NOW()'),
34
	        	'updated_at' => \DB::raw('NOW()')
35
	        	],
36
	        	[
37
	        	'name'       => 'find',
38
	        	'model'      => 'users',
39
	        	'created_at' => \DB::raw('NOW()'),
40
	        	'updated_at' => \DB::raw('NOW()')
41
	        	],
42
	        	[
43
	        	'name'       => 'list',
44
	        	'model'      => 'users',
45
	        	'created_at' => \DB::raw('NOW()'),
46
	        	'updated_at' => \DB::raw('NOW()')
47
	        	],
48
	        	[
49
	        	'name'       => 'search',
50
	        	'model'      => 'users',
51
	        	'created_at' => \DB::raw('NOW()'),
52
	        	'updated_at' => \DB::raw('NOW()')
53
	        	],
54
	        	[
55
	        	'name'       => 'findby',
56
	        	'model'      => 'users',
57
	        	'created_at' => \DB::raw('NOW()'),
58
	        	'updated_at' => \DB::raw('NOW()')
59
	        	],
60
	        	[
61
	        	'name'       => 'first',
62
	        	'model'      => 'users',
63
	        	'created_at' => \DB::raw('NOW()'),
64
	        	'updated_at' => \DB::raw('NOW()')
65
	        	],
66
	        	[
67
	        	'name'       => 'paginate',
68
	        	'model'      => 'users',
69
	        	'created_at' => \DB::raw('NOW()'),
70
	        	'updated_at' => \DB::raw('NOW()')
71
	        	],
72
	        	[
73
	        	'name'       => 'paginateby',
74
	        	'model'      => 'users',
75
	        	'created_at' => \DB::raw('NOW()'),
76
	        	'updated_at' => \DB::raw('NOW()')
77
	        	],
78
	        	[
79
	        	'name'       => 'assigngroups',
80
	        	'model'      => 'users',
81
	        	'created_at' => \DB::raw('NOW()'),
82
	        	'updated_at' => \DB::raw('NOW()')
83
	        	],
84
	        	[
85
	        	'name'       => 'block',
86
	        	'model'      => 'users',
87
	        	'created_at' => \DB::raw('NOW()'),
88
	        	'updated_at' => \DB::raw('NOW()')
89
	        	],
90
	        	[
91
	        	'name'       => 'unblock',
92
	        	'model'      => 'users',
93
	        	'created_at' => \DB::raw('NOW()'),
94
	        	'updated_at' => \DB::raw('NOW()')
95
	        	],
96
	        	[
97
	        	'name'       => 'group',
98
	        	'model'      => 'users',
99
	        	'created_at' => \DB::raw('NOW()'),
100
	        	'updated_at' => \DB::raw('NOW()')
101
	        	],
102
                [
103
                'name'       => 'deleted',
104
                'model'      => 'users',
105
                'created_at' => \DB::raw('NOW()'),
106
                'updated_at' => \DB::raw('NOW()')
107
                ],
108
                [
109
                'name'       => 'restore',
110
                'model'      => 'users',
111
                'created_at' => \DB::raw('NOW()'),
112
                'updated_at' => \DB::raw('NOW()')
113
                ]
114
        	]
115
        );
116
117
		/**
118
		 * Create Default users.
119
		 */
120
		\DB::table('users')->insertGetId(
121
            [
122
			'name'       => 'Admin',
123
			'email'      => '[email protected]',
124
			'password'   => bcrypt('123456'),
125
			'created_at' => \DB::raw('NOW()'),
126
			'updated_at' => \DB::raw('NOW()')
127
			]
128
        );
129
    }
130
}
131