@@ -9,29 +9,29 @@ |
||
9 | 9 | |
10 | 10 | public function up(): void |
11 | 11 | { |
12 | - //Action when migrate up |
|
13 | - $this->create('roles', function (CreateTable $table) { |
|
14 | - $table->integer('id') |
|
15 | - ->autoincrement() |
|
16 | - ->primary(); |
|
17 | - $table->string('name') |
|
18 | - ->description('The role name') |
|
19 | - ->notNull(); |
|
20 | - $table->string('description') |
|
21 | - ->description('The role description'); |
|
22 | - $table->datetime('created_at') |
|
23 | - ->description('role created at') |
|
24 | - ->notNull(); |
|
25 | - $table->datetime('updated_at') |
|
26 | - ->description('role updated at'); |
|
12 | + //Action when migrate up |
|
13 | + $this->create('roles', function (CreateTable $table) { |
|
14 | + $table->integer('id') |
|
15 | + ->autoincrement() |
|
16 | + ->primary(); |
|
17 | + $table->string('name') |
|
18 | + ->description('The role name') |
|
19 | + ->notNull(); |
|
20 | + $table->string('description') |
|
21 | + ->description('The role description'); |
|
22 | + $table->datetime('created_at') |
|
23 | + ->description('role created at') |
|
24 | + ->notNull(); |
|
25 | + $table->datetime('updated_at') |
|
26 | + ->description('role updated at'); |
|
27 | 27 | |
28 | - $table->engine('INNODB'); |
|
29 | - }); |
|
28 | + $table->engine('INNODB'); |
|
29 | + }); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | public function down(): void |
33 | 33 | { |
34 | - //Action when migrate down |
|
35 | - $this->drop('roles'); |
|
34 | + //Action when migrate down |
|
35 | + $this->drop('roles'); |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 | \ No newline at end of file |
@@ -9,32 +9,32 @@ |
||
9 | 9 | |
10 | 10 | public function up(): void |
11 | 11 | { |
12 | - //Action when migrate up |
|
13 | - $this->create('permissions', function (CreateTable $table) { |
|
14 | - $table->integer('id') |
|
15 | - ->autoincrement() |
|
16 | - ->primary(); |
|
17 | - $table->string('code') |
|
18 | - ->description('The permission code') |
|
19 | - ->unique() |
|
20 | - ->notNull(); |
|
21 | - $table->string('description') |
|
22 | - ->description('The permission description'); |
|
23 | - $table->string('depend') |
|
24 | - ->description('The permission dependency'); |
|
25 | - $table->datetime('created_at') |
|
26 | - ->description('permission created at') |
|
27 | - ->notNull(); |
|
28 | - $table->datetime('updated_at') |
|
29 | - ->description('permission updated at'); |
|
12 | + //Action when migrate up |
|
13 | + $this->create('permissions', function (CreateTable $table) { |
|
14 | + $table->integer('id') |
|
15 | + ->autoincrement() |
|
16 | + ->primary(); |
|
17 | + $table->string('code') |
|
18 | + ->description('The permission code') |
|
19 | + ->unique() |
|
20 | + ->notNull(); |
|
21 | + $table->string('description') |
|
22 | + ->description('The permission description'); |
|
23 | + $table->string('depend') |
|
24 | + ->description('The permission dependency'); |
|
25 | + $table->datetime('created_at') |
|
26 | + ->description('permission created at') |
|
27 | + ->notNull(); |
|
28 | + $table->datetime('updated_at') |
|
29 | + ->description('permission updated at'); |
|
30 | 30 | |
31 | - $table->engine('INNODB'); |
|
32 | - }); |
|
31 | + $table->engine('INNODB'); |
|
32 | + }); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | public function down(): void |
36 | 36 | { |
37 | - //Action when migrate down |
|
38 | - $this->drop('permissions'); |
|
37 | + //Action when migrate down |
|
38 | + $this->drop('permissions'); |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | \ No newline at end of file |
@@ -9,55 +9,55 @@ |
||
9 | 9 | |
10 | 10 | public function up(): void |
11 | 11 | { |
12 | - //Action when migrate up |
|
13 | - $this->create('users', function (CreateTable $table) { |
|
14 | - $table->integer('id') |
|
15 | - ->autoincrement() |
|
16 | - ->primary(); |
|
17 | - |
|
18 | - $table->string('username') |
|
19 | - ->description('The user username') |
|
20 | - ->unique() |
|
21 | - ->notNull(); |
|
22 | - |
|
23 | - $table->string('email') |
|
24 | - ->description('The user email') |
|
25 | - ->unique() |
|
26 | - ->notNull(); |
|
27 | - |
|
28 | - $table->string('password') |
|
29 | - ->description('The user password') |
|
30 | - ->notNull(); |
|
31 | - |
|
32 | - $table->integer('status') |
|
33 | - ->size('tiny') |
|
34 | - ->description('The user status') |
|
35 | - ->defaultValue(0); |
|
36 | - |
|
37 | - $table->integer('age') |
|
38 | - ->size('tiny') |
|
39 | - ->description('The user age'); |
|
40 | - |
|
41 | - $table->string('lastname') |
|
42 | - ->description('The user lastname'); |
|
43 | - |
|
44 | - $table->string('firstname') |
|
45 | - ->description('The user firstname'); |
|
46 | - |
|
47 | - $table->datetime('created_at') |
|
48 | - ->description('created date') |
|
49 | - ->notNull(); |
|
50 | - |
|
51 | - $table->datetime('updated_at') |
|
52 | - ->description('last updated date'); |
|
12 | + //Action when migrate up |
|
13 | + $this->create('users', function (CreateTable $table) { |
|
14 | + $table->integer('id') |
|
15 | + ->autoincrement() |
|
16 | + ->primary(); |
|
17 | + |
|
18 | + $table->string('username') |
|
19 | + ->description('The user username') |
|
20 | + ->unique() |
|
21 | + ->notNull(); |
|
22 | + |
|
23 | + $table->string('email') |
|
24 | + ->description('The user email') |
|
25 | + ->unique() |
|
26 | + ->notNull(); |
|
27 | + |
|
28 | + $table->string('password') |
|
29 | + ->description('The user password') |
|
30 | + ->notNull(); |
|
31 | + |
|
32 | + $table->integer('status') |
|
33 | + ->size('tiny') |
|
34 | + ->description('The user status') |
|
35 | + ->defaultValue(0); |
|
36 | + |
|
37 | + $table->integer('age') |
|
38 | + ->size('tiny') |
|
39 | + ->description('The user age'); |
|
40 | + |
|
41 | + $table->string('lastname') |
|
42 | + ->description('The user lastname'); |
|
43 | + |
|
44 | + $table->string('firstname') |
|
45 | + ->description('The user firstname'); |
|
46 | + |
|
47 | + $table->datetime('created_at') |
|
48 | + ->description('created date') |
|
49 | + ->notNull(); |
|
50 | + |
|
51 | + $table->datetime('updated_at') |
|
52 | + ->description('last updated date'); |
|
53 | 53 | |
54 | - $table->engine('INNODB'); |
|
55 | - }); |
|
54 | + $table->engine('INNODB'); |
|
55 | + }); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | public function down(): void |
59 | 59 | { |
60 | - //Action when migrate down |
|
61 | - $this->drop('users'); |
|
60 | + //Action when migrate down |
|
61 | + $this->drop('users'); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | \ No newline at end of file |
@@ -9,28 +9,28 @@ |
||
9 | 9 | |
10 | 10 | public function up(): void |
11 | 11 | { |
12 | - //Action when migrate up |
|
13 | - $this->create('permissions_roles', function (CreateTable $table) { |
|
14 | - $table->integer('permission_id'); |
|
15 | - $table->integer('role_id'); |
|
12 | + //Action when migrate up |
|
13 | + $this->create('permissions_roles', function (CreateTable $table) { |
|
14 | + $table->integer('permission_id'); |
|
15 | + $table->integer('role_id'); |
|
16 | 16 | |
17 | - $table->primary(['permission_id', 'role_id']); |
|
17 | + $table->primary(['permission_id', 'role_id']); |
|
18 | 18 | |
19 | - $table->foreign('permission_id') |
|
20 | - ->references('permissions', 'id') |
|
21 | - ->onDelete('CASCADE'); |
|
19 | + $table->foreign('permission_id') |
|
20 | + ->references('permissions', 'id') |
|
21 | + ->onDelete('CASCADE'); |
|
22 | 22 | |
23 | - $table->foreign('role_id') |
|
24 | - ->references('roles', 'id') |
|
25 | - ->onDelete('CASCADE'); |
|
23 | + $table->foreign('role_id') |
|
24 | + ->references('roles', 'id') |
|
25 | + ->onDelete('CASCADE'); |
|
26 | 26 | |
27 | - $table->engine('INNODB'); |
|
28 | - }); |
|
27 | + $table->engine('INNODB'); |
|
28 | + }); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | public function down(): void |
32 | 32 | { |
33 | - //Action when migrate down |
|
34 | - $this->drop('permissions_roles'); |
|
33 | + //Action when migrate down |
|
34 | + $this->drop('permissions_roles'); |
|
35 | 35 | } |
36 | 36 | } |
37 | 37 | \ No newline at end of file |
@@ -9,28 +9,28 @@ |
||
9 | 9 | |
10 | 10 | public function up(): void |
11 | 11 | { |
12 | - //Action when migrate up |
|
13 | - $this->create('roles_users', function (CreateTable $table) { |
|
14 | - $table->integer('user_id'); |
|
15 | - $table->integer('role_id'); |
|
12 | + //Action when migrate up |
|
13 | + $this->create('roles_users', function (CreateTable $table) { |
|
14 | + $table->integer('user_id'); |
|
15 | + $table->integer('role_id'); |
|
16 | 16 | |
17 | - $table->primary(['user_id', 'role_id']); |
|
17 | + $table->primary(['user_id', 'role_id']); |
|
18 | 18 | |
19 | - $table->foreign('user_id') |
|
19 | + $table->foreign('user_id') |
|
20 | 20 | ->references('users', 'id') |
21 | 21 | ->onDelete('CASCADE'); |
22 | 22 | |
23 | - $table->foreign('role_id') |
|
23 | + $table->foreign('role_id') |
|
24 | 24 | ->references('roles', 'id') |
25 | 25 | ->onDelete('CASCADE'); |
26 | 26 | |
27 | - $table->engine('INNODB'); |
|
28 | - }); |
|
27 | + $table->engine('INNODB'); |
|
28 | + }); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | public function down(): void |
32 | 32 | { |
33 | - //Action when migrate down |
|
34 | - $this->drop('roles_users'); |
|
33 | + //Action when migrate down |
|
34 | + $this->drop('roles_users'); |
|
35 | 35 | } |
36 | 36 | } |
37 | 37 | \ No newline at end of file |
@@ -163,11 +163,11 @@ |
||
163 | 163 | } |
164 | 164 | |
165 | 165 | $data = [ |
166 | - 'id' => $user->id, |
|
167 | - 'username' => $user->username, |
|
168 | - 'lastname' => $user->lastname, |
|
169 | - 'firstname' => $user->firstname, |
|
170 | - 'permissions' => array_unique($permissions), |
|
166 | + 'id' => $user->id, |
|
167 | + 'username' => $user->username, |
|
168 | + 'lastname' => $user->lastname, |
|
169 | + 'firstname' => $user->firstname, |
|
170 | + 'permissions' => array_unique($permissions), |
|
171 | 171 | ]; |
172 | 172 | |
173 | 173 | $this->session->set('user', $data); |
@@ -116,7 +116,7 @@ |
||
116 | 116 | $this->template, |
117 | 117 | 'user/login', |
118 | 118 | [ |
119 | - 'param' => $formParam |
|
119 | + 'param' => $formParam |
|
120 | 120 | ] |
121 | 121 | ); |
122 | 122 | } |
@@ -46,8 +46,8 @@ |
||
46 | 46 | { |
47 | 47 | $id = (int) $request->getAttribute('id'); |
48 | 48 | $user = $this->userRepository |
49 | - ->with('roles') |
|
50 | - ->find($id); |
|
49 | + ->with('roles') |
|
50 | + ->find($id); |
|
51 | 51 | if (!$user) { |
52 | 52 | $this->session->setFlash('error', 'Can not find the user'); |
53 | 53 | $this->logger->warning('Can not find user with id {id}', ['id' => $id]); |