@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | $factory->define(App\Modules\Acl\AclGroup::class, function (Faker\Generator $faker) { |
4 | - return [ |
|
5 | - 'name' => $faker->unique->word(), |
|
6 | - 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
|
7 | - 'updated_at' => $faker->dateTimeBetween('-1 years', 'now') |
|
8 | - ]; |
|
4 | + return [ |
|
5 | + 'name' => $faker->unique->word(), |
|
6 | + 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
|
7 | + 'updated_at' => $faker->dateTimeBetween('-1 years', 'now') |
|
8 | + ]; |
|
9 | 9 | }); |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -$factory->define(App\Modules\Acl\AclGroup::class, function (Faker\Generator $faker) { |
|
3 | +$factory->define(App\Modules\Acl\AclGroup::class, function(Faker\Generator $faker) { |
|
4 | 4 | return [ |
5 | 5 | 'name' => $faker->unique->word(), |
6 | 6 | 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | $factory->define(App\Modules\Acl\AclPermission::class, function (Faker\Generator $faker) { |
4 | - return [ |
|
5 | - 'name' => $faker->randomElement(['save', 'delete', 'find', 'paginate']), |
|
6 | - 'model' => $faker->randomElement(['users', 'groups', 'settings', 'notifications']), |
|
7 | - 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
|
8 | - 'updated_at' => $faker->dateTimeBetween('-1 years', 'now') |
|
9 | - ]; |
|
4 | + return [ |
|
5 | + 'name' => $faker->randomElement(['save', 'delete', 'find', 'paginate']), |
|
6 | + 'model' => $faker->randomElement(['users', 'groups', 'settings', 'notifications']), |
|
7 | + 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
|
8 | + 'updated_at' => $faker->dateTimeBetween('-1 years', 'now') |
|
9 | + ]; |
|
10 | 10 | }); |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -$factory->define(App\Modules\Acl\AclPermission::class, function (Faker\Generator $faker) { |
|
3 | +$factory->define(App\Modules\Acl\AclPermission::class, function(Faker\Generator $faker) { |
|
4 | 4 | return [ |
5 | 5 | 'name' => $faker->randomElement(['save', 'delete', 'find', 'paginate']), |
6 | 6 | 'model' => $faker->randomElement(['users', 'groups', 'settings', 'notifications']), |
@@ -1,15 +1,15 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | $factory->define(App\Modules\Acl\OauthClient::class, function (Faker\Generator $faker) { |
4 | - return [ |
|
5 | - 'user_id' => $faker->randomDigit(), |
|
6 | - 'name' => $faker->name(), |
|
7 | - 'secret' => \Illuminate\Support\Str::random(40), |
|
8 | - 'redirect' => $faker->url(), |
|
9 | - 'personal_access_client' => 0, |
|
10 | - 'password_client' => 0, |
|
11 | - 'revoked' => $faker->boolean(), |
|
12 | - 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
|
13 | - 'updated_at' => $faker->dateTimeBetween('-1 years', 'now') |
|
14 | - ]; |
|
4 | + return [ |
|
5 | + 'user_id' => $faker->randomDigit(), |
|
6 | + 'name' => $faker->name(), |
|
7 | + 'secret' => \Illuminate\Support\Str::random(40), |
|
8 | + 'redirect' => $faker->url(), |
|
9 | + 'personal_access_client' => 0, |
|
10 | + 'password_client' => 0, |
|
11 | + 'revoked' => $faker->boolean(), |
|
12 | + 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
|
13 | + 'updated_at' => $faker->dateTimeBetween('-1 years', 'now') |
|
14 | + ]; |
|
15 | 15 | }); |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -$factory->define(App\Modules\Acl\OauthClient::class, function (Faker\Generator $faker) { |
|
3 | +$factory->define(App\Modules\Acl\OauthClient::class, function(Faker\Generator $faker) { |
|
4 | 4 | return [ |
5 | 5 | 'user_id' => $faker->randomDigit(), |
6 | 6 | 'name' => $faker->name(), |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | $factory->define(App\Modules\Acl\AclUser::class, function (Faker\Generator $faker) { |
4 | - return [ |
|
5 | - 'profile_picture' => 'http://lorempixel.com/400/200/', |
|
6 | - 'name' => $faker->name(), |
|
7 | - 'email' => $faker->safeEmail(), |
|
8 | - 'password' => 123456, |
|
9 | - 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
|
10 | - 'updated_at' => $faker->dateTimeBetween('-1 years', 'now') |
|
11 | - ]; |
|
4 | + return [ |
|
5 | + 'profile_picture' => 'http://lorempixel.com/400/200/', |
|
6 | + 'name' => $faker->name(), |
|
7 | + 'email' => $faker->safeEmail(), |
|
8 | + 'password' => 123456, |
|
9 | + 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
|
10 | + 'updated_at' => $faker->dateTimeBetween('-1 years', 'now') |
|
11 | + ]; |
|
12 | 12 | }); |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -$factory->define(App\Modules\Acl\AclUser::class, function (Faker\Generator $faker) { |
|
3 | +$factory->define(App\Modules\Acl\AclUser::class, function(Faker\Generator $faker) { |
|
4 | 4 | return [ |
5 | 5 | 'profile_picture' => 'http://lorempixel.com/400/200/', |
6 | 6 | 'name' => $faker->name(), |
@@ -5,66 +5,66 @@ |
||
5 | 5 | |
6 | 6 | class Groups extends Migration |
7 | 7 | { |
8 | - /** |
|
9 | - * Run the migrations. |
|
10 | - * |
|
11 | - * @return void |
|
12 | - */ |
|
13 | - public function up() |
|
14 | - { |
|
15 | - Schema::create('groups', function (Blueprint $table) { |
|
16 | - $table->increments('id'); |
|
17 | - $table->string('name', 100)->unique(); |
|
18 | - $table->softDeletes(); |
|
19 | - $table->timestamps(); |
|
20 | - }); |
|
8 | + /** |
|
9 | + * Run the migrations. |
|
10 | + * |
|
11 | + * @return void |
|
12 | + */ |
|
13 | + public function up() |
|
14 | + { |
|
15 | + Schema::create('groups', function (Blueprint $table) { |
|
16 | + $table->increments('id'); |
|
17 | + $table->string('name', 100)->unique(); |
|
18 | + $table->softDeletes(); |
|
19 | + $table->timestamps(); |
|
20 | + }); |
|
21 | 21 | |
22 | - Schema::create('users_groups', function (Blueprint $table) { |
|
23 | - $table->increments('id'); |
|
24 | - $table->integer('user_id'); |
|
25 | - $table->integer('group_id'); |
|
26 | - $table->softDeletes(); |
|
27 | - $table->timestamps(); |
|
22 | + Schema::create('users_groups', function (Blueprint $table) { |
|
23 | + $table->increments('id'); |
|
24 | + $table->integer('user_id'); |
|
25 | + $table->integer('group_id'); |
|
26 | + $table->softDeletes(); |
|
27 | + $table->timestamps(); |
|
28 | 28 | |
29 | - $table->index(['user_id']); |
|
30 | - }); |
|
29 | + $table->index(['user_id']); |
|
30 | + }); |
|
31 | 31 | |
32 | - /** |
|
33 | - * Create Default groups. |
|
34 | - */ |
|
35 | - \DB::table('groups')->insert( |
|
36 | - [ |
|
37 | - [ |
|
38 | - 'name' => 'Admin', |
|
39 | - 'created_at' => \DB::raw('NOW()'), |
|
40 | - 'updated_at' => \DB::raw('NOW()') |
|
41 | - ] |
|
42 | - ] |
|
43 | - ); |
|
32 | + /** |
|
33 | + * Create Default groups. |
|
34 | + */ |
|
35 | + \DB::table('groups')->insert( |
|
36 | + [ |
|
37 | + [ |
|
38 | + 'name' => 'Admin', |
|
39 | + 'created_at' => \DB::raw('NOW()'), |
|
40 | + 'updated_at' => \DB::raw('NOW()') |
|
41 | + ] |
|
42 | + ] |
|
43 | + ); |
|
44 | 44 | |
45 | - /** |
|
46 | - * Assign default users to admin groups. |
|
47 | - */ |
|
48 | - $adminGroupId = \DB::table('groups')->where('name', 'admin')->select('id')->first()->id; |
|
49 | - $adminUserId = \DB::table('users')->where('email', '[email protected]')->select('id')->first()->id; |
|
50 | - \DB::table('users_groups')->insert( |
|
51 | - [ |
|
52 | - 'user_id' => $adminUserId, |
|
53 | - 'group_id' => $adminGroupId, |
|
54 | - 'created_at' => \DB::raw('NOW()'), |
|
55 | - 'updated_at' => \DB::raw('NOW()') |
|
56 | - ] |
|
57 | - ); |
|
58 | - } |
|
45 | + /** |
|
46 | + * Assign default users to admin groups. |
|
47 | + */ |
|
48 | + $adminGroupId = \DB::table('groups')->where('name', 'admin')->select('id')->first()->id; |
|
49 | + $adminUserId = \DB::table('users')->where('email', '[email protected]')->select('id')->first()->id; |
|
50 | + \DB::table('users_groups')->insert( |
|
51 | + [ |
|
52 | + 'user_id' => $adminUserId, |
|
53 | + 'group_id' => $adminGroupId, |
|
54 | + 'created_at' => \DB::raw('NOW()'), |
|
55 | + 'updated_at' => \DB::raw('NOW()') |
|
56 | + ] |
|
57 | + ); |
|
58 | + } |
|
59 | 59 | |
60 | - /** |
|
61 | - * Reverse the migrations. |
|
62 | - * |
|
63 | - * @return void |
|
64 | - */ |
|
65 | - public function down() |
|
66 | - { |
|
67 | - Schema::dropIfExists('groups'); |
|
68 | - Schema::dropIfExists('users_groups'); |
|
69 | - } |
|
60 | + /** |
|
61 | + * Reverse the migrations. |
|
62 | + * |
|
63 | + * @return void |
|
64 | + */ |
|
65 | + public function down() |
|
66 | + { |
|
67 | + Schema::dropIfExists('groups'); |
|
68 | + Schema::dropIfExists('users_groups'); |
|
69 | + } |
|
70 | 70 | } |
@@ -12,14 +12,14 @@ |
||
12 | 12 | */ |
13 | 13 | public function up() |
14 | 14 | { |
15 | - Schema::create('groups', function (Blueprint $table) { |
|
15 | + Schema::create('groups', function(Blueprint $table) { |
|
16 | 16 | $table->increments('id'); |
17 | 17 | $table->string('name', 100)->unique(); |
18 | 18 | $table->softDeletes(); |
19 | 19 | $table->timestamps(); |
20 | 20 | }); |
21 | 21 | |
22 | - Schema::create('users_groups', function (Blueprint $table) { |
|
22 | + Schema::create('users_groups', function(Blueprint $table) { |
|
23 | 23 | $table->increments('id'); |
24 | 24 | $table->integer('user_id'); |
25 | 25 | $table->integer('group_id'); |
@@ -5,40 +5,40 @@ |
||
5 | 5 | |
6 | 6 | class Permissions extends Migration |
7 | 7 | { |
8 | - /** |
|
9 | - * Run the migrations. |
|
10 | - * |
|
11 | - * @return void |
|
12 | - */ |
|
13 | - public function up() |
|
14 | - { |
|
15 | - Schema::create('permissions', function (Blueprint $table) { |
|
16 | - $table->increments('id'); |
|
17 | - $table->string('name', 100); |
|
18 | - $table->string('model', 100); |
|
19 | - $table->softDeletes(); |
|
20 | - $table->timestamps(); |
|
21 | - $table->unique(array('name', 'model')); |
|
22 | - }); |
|
23 | - Schema::create('groups_permissions', function (Blueprint $table) { |
|
24 | - $table->increments('id'); |
|
25 | - $table->integer('group_id'); |
|
26 | - $table->integer('permission_id'); |
|
27 | - $table->softDeletes(); |
|
28 | - $table->timestamps(); |
|
8 | + /** |
|
9 | + * Run the migrations. |
|
10 | + * |
|
11 | + * @return void |
|
12 | + */ |
|
13 | + public function up() |
|
14 | + { |
|
15 | + Schema::create('permissions', function (Blueprint $table) { |
|
16 | + $table->increments('id'); |
|
17 | + $table->string('name', 100); |
|
18 | + $table->string('model', 100); |
|
19 | + $table->softDeletes(); |
|
20 | + $table->timestamps(); |
|
21 | + $table->unique(array('name', 'model')); |
|
22 | + }); |
|
23 | + Schema::create('groups_permissions', function (Blueprint $table) { |
|
24 | + $table->increments('id'); |
|
25 | + $table->integer('group_id'); |
|
26 | + $table->integer('permission_id'); |
|
27 | + $table->softDeletes(); |
|
28 | + $table->timestamps(); |
|
29 | 29 | |
30 | - $table->index(['group_id']); |
|
31 | - }); |
|
32 | - } |
|
30 | + $table->index(['group_id']); |
|
31 | + }); |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * Reverse the migrations. |
|
36 | - * |
|
37 | - * @return void |
|
38 | - */ |
|
39 | - public function down() |
|
40 | - { |
|
41 | - Schema::dropIfExists('permissions'); |
|
42 | - Schema::dropIfExists('groups_permissions'); |
|
43 | - } |
|
34 | + /** |
|
35 | + * Reverse the migrations. |
|
36 | + * |
|
37 | + * @return void |
|
38 | + */ |
|
39 | + public function down() |
|
40 | + { |
|
41 | + Schema::dropIfExists('permissions'); |
|
42 | + Schema::dropIfExists('groups_permissions'); |
|
43 | + } |
|
44 | 44 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | public function up() |
14 | 14 | { |
15 | - Schema::create('permissions', function (Blueprint $table) { |
|
15 | + Schema::create('permissions', function(Blueprint $table) { |
|
16 | 16 | $table->increments('id'); |
17 | 17 | $table->string('name', 100); |
18 | 18 | $table->string('model', 100); |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $table->timestamps(); |
21 | 21 | $table->unique(array('name', 'model')); |
22 | 22 | }); |
23 | - Schema::create('groups_permissions', function (Blueprint $table) { |
|
23 | + Schema::create('groups_permissions', function(Blueprint $table) { |
|
24 | 24 | $table->increments('id'); |
25 | 25 | $table->integer('group_id'); |
26 | 26 | $table->integer('permission_id'); |
@@ -5,51 +5,51 @@ |
||
5 | 5 | |
6 | 6 | class Users extends Migration |
7 | 7 | { |
8 | - /** |
|
9 | - * Run the migrations. |
|
10 | - * |
|
11 | - * @return void |
|
12 | - */ |
|
13 | - public function up() |
|
14 | - { |
|
15 | - Schema::create('users', function (Blueprint $table) { |
|
16 | - $table->increments('id'); |
|
17 | - $table->string('profile_picture', 150)->nullable(); |
|
18 | - $table->string('name', 100)->nullable(); |
|
19 | - $table->string('email')->unique(); |
|
20 | - $table->string('password', 60)->nullable(); |
|
21 | - $table->boolean('blocked')->default(0); |
|
22 | - $table->boolean('confirmed')->default(0); |
|
23 | - $table->string('confirmation_code')->nullable(); |
|
24 | - $table->string('locale', 2)->default('en'); |
|
25 | - $table->string('timezone', 50)->default('Africa/Cairo'); |
|
26 | - $table->softDeletes(); |
|
27 | - $table->rememberToken(); |
|
28 | - $table->timestamps(); |
|
29 | - }); |
|
8 | + /** |
|
9 | + * Run the migrations. |
|
10 | + * |
|
11 | + * @return void |
|
12 | + */ |
|
13 | + public function up() |
|
14 | + { |
|
15 | + Schema::create('users', function (Blueprint $table) { |
|
16 | + $table->increments('id'); |
|
17 | + $table->string('profile_picture', 150)->nullable(); |
|
18 | + $table->string('name', 100)->nullable(); |
|
19 | + $table->string('email')->unique(); |
|
20 | + $table->string('password', 60)->nullable(); |
|
21 | + $table->boolean('blocked')->default(0); |
|
22 | + $table->boolean('confirmed')->default(0); |
|
23 | + $table->string('confirmation_code')->nullable(); |
|
24 | + $table->string('locale', 2)->default('en'); |
|
25 | + $table->string('timezone', 50)->default('Africa/Cairo'); |
|
26 | + $table->softDeletes(); |
|
27 | + $table->rememberToken(); |
|
28 | + $table->timestamps(); |
|
29 | + }); |
|
30 | 30 | |
31 | - /** |
|
32 | - * Create Default users. |
|
33 | - */ |
|
34 | - \DB::table('users')->insertGetId( |
|
35 | - [ |
|
36 | - 'name' => 'Admin', |
|
37 | - 'email' => '[email protected]', |
|
38 | - 'password' => bcrypt('123456'), |
|
39 | - 'confirmed' => 1, |
|
40 | - 'created_at' => \DB::raw('NOW()'), |
|
41 | - 'updated_at' => \DB::raw('NOW()') |
|
42 | - ] |
|
43 | - ); |
|
44 | - } |
|
31 | + /** |
|
32 | + * Create Default users. |
|
33 | + */ |
|
34 | + \DB::table('users')->insertGetId( |
|
35 | + [ |
|
36 | + 'name' => 'Admin', |
|
37 | + 'email' => '[email protected]', |
|
38 | + 'password' => bcrypt('123456'), |
|
39 | + 'confirmed' => 1, |
|
40 | + 'created_at' => \DB::raw('NOW()'), |
|
41 | + 'updated_at' => \DB::raw('NOW()') |
|
42 | + ] |
|
43 | + ); |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * Reverse the migrations. |
|
48 | - * |
|
49 | - * @return void |
|
50 | - */ |
|
51 | - public function down() |
|
52 | - { |
|
53 | - Schema::dropIfExists('users'); |
|
54 | - } |
|
46 | + /** |
|
47 | + * Reverse the migrations. |
|
48 | + * |
|
49 | + * @return void |
|
50 | + */ |
|
51 | + public function down() |
|
52 | + { |
|
53 | + Schema::dropIfExists('users'); |
|
54 | + } |
|
55 | 55 | } |
@@ -12,7 +12,7 @@ |
||
12 | 12 | */ |
13 | 13 | public function up() |
14 | 14 | { |
15 | - Schema::create('users', function (Blueprint $table) { |
|
15 | + Schema::create('users', function(Blueprint $table) { |
|
16 | 16 | $table->increments('id'); |
17 | 17 | $table->string('profile_picture', 150)->nullable(); |
18 | 18 | $table->string('name', 100)->nullable(); |
@@ -6,112 +6,112 @@ |
||
6 | 6 | |
7 | 7 | class UsersTableSeeder extends Seeder |
8 | 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 | - } |
|
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 | 117 | } |
@@ -6,27 +6,27 @@ |
||
6 | 6 | |
7 | 7 | class AssignRelationsSeeder extends Seeder |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the database seeds. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function run() |
|
15 | - { |
|
16 | - $adminGroupId = \DB::table('groups')->where('name', 'admin')->select('id')->first()->id; |
|
9 | + /** |
|
10 | + * Run the database seeds. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function run() |
|
15 | + { |
|
16 | + $adminGroupId = \DB::table('groups')->where('name', 'admin')->select('id')->first()->id; |
|
17 | 17 | |
18 | - /** |
|
19 | - * Assign the permissions to the admin group. |
|
20 | - */ |
|
21 | - \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['users', 'permissions', 'groups', 'oauthClients'])->each(function ($permission) use ($adminGroupId) { |
|
22 | - \DB::table('groups_permissions')->insert( |
|
23 | - [ |
|
24 | - 'permission_id' => $permission->id, |
|
25 | - 'group_id' => $adminGroupId, |
|
26 | - 'created_at' => \DB::raw('NOW()'), |
|
27 | - 'updated_at' => \DB::raw('NOW()') |
|
28 | - ] |
|
29 | - ); |
|
30 | - }); |
|
31 | - } |
|
18 | + /** |
|
19 | + * Assign the permissions to the admin group. |
|
20 | + */ |
|
21 | + \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['users', 'permissions', 'groups', 'oauthClients'])->each(function ($permission) use ($adminGroupId) { |
|
22 | + \DB::table('groups_permissions')->insert( |
|
23 | + [ |
|
24 | + 'permission_id' => $permission->id, |
|
25 | + 'group_id' => $adminGroupId, |
|
26 | + 'created_at' => \DB::raw('NOW()'), |
|
27 | + 'updated_at' => \DB::raw('NOW()') |
|
28 | + ] |
|
29 | + ); |
|
30 | + }); |
|
31 | + } |
|
32 | 32 | } |
@@ -18,7 +18,7 @@ |
||
18 | 18 | /** |
19 | 19 | * Assign the permissions to the admin group. |
20 | 20 | */ |
21 | - \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['users', 'permissions', 'groups', 'oauthClients'])->each(function ($permission) use ($adminGroupId) { |
|
21 | + \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['users', 'permissions', 'groups', 'oauthClients'])->each(function($permission) use ($adminGroupId) { |
|
22 | 22 | \DB::table('groups_permissions')->insert( |
23 | 23 | [ |
24 | 24 | 'permission_id' => $permission->id, |