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