@@ -6,41 +6,41 @@ |
||
6 | 6 | |
7 | 7 | class ApiSkeletonServiceProvider extends ServiceProvider |
8 | 8 | { |
9 | - /** |
|
10 | - * Perform post-registration booting of services. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function boot() |
|
15 | - { |
|
16 | - $this->publishes([ |
|
17 | - __DIR__.'/Modules' => app_path('Modules'), |
|
18 | - __DIR__.'/Modules/Core/Resources/Assets' => base_path('public/doc/assets'), |
|
19 | - __DIR__.'/../lang' => base_path('resources/lang'), |
|
20 | - __DIR__.'/../files/Handler.php' => app_path('Exceptions/Handler.php'), |
|
21 | - __DIR__.'/../files/AuthServiceProvider.php' => app_path('Providers/AuthServiceProvider.php'), |
|
22 | - __DIR__.'/../files/BroadcastServiceProvider.php' => app_path('Providers/BroadcastServiceProvider.php'), |
|
23 | - __DIR__.'/../files/Kernel.php' => app_path('Console/Kernel.php'), |
|
24 | - __DIR__.'/../files/channels.php' => base_path('routes/channels.php'), |
|
25 | - __DIR__.'/../phpcs.xml' => base_path('/phpcs.xml'), |
|
26 | - ]); |
|
9 | + /** |
|
10 | + * Perform post-registration booting of services. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function boot() |
|
15 | + { |
|
16 | + $this->publishes([ |
|
17 | + __DIR__.'/Modules' => app_path('Modules'), |
|
18 | + __DIR__.'/Modules/Core/Resources/Assets' => base_path('public/doc/assets'), |
|
19 | + __DIR__.'/../lang' => base_path('resources/lang'), |
|
20 | + __DIR__.'/../files/Handler.php' => app_path('Exceptions/Handler.php'), |
|
21 | + __DIR__.'/../files/AuthServiceProvider.php' => app_path('Providers/AuthServiceProvider.php'), |
|
22 | + __DIR__.'/../files/BroadcastServiceProvider.php' => app_path('Providers/BroadcastServiceProvider.php'), |
|
23 | + __DIR__.'/../files/Kernel.php' => app_path('Console/Kernel.php'), |
|
24 | + __DIR__.'/../files/channels.php' => base_path('routes/channels.php'), |
|
25 | + __DIR__.'/../phpcs.xml' => base_path('/phpcs.xml'), |
|
26 | + ]); |
|
27 | 27 | |
28 | - $this->publishes([ |
|
29 | - __DIR__.'/../config/skeleton.php' => config_path('skeleton.php'), |
|
30 | - __DIR__.'/../files/auth.php' => config_path('auth.php'), |
|
31 | - ], 'config'); |
|
32 | - } |
|
28 | + $this->publishes([ |
|
29 | + __DIR__.'/../config/skeleton.php' => config_path('skeleton.php'), |
|
30 | + __DIR__.'/../files/auth.php' => config_path('auth.php'), |
|
31 | + ], 'config'); |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * Register any package services. |
|
36 | - * |
|
37 | - * @return void |
|
38 | - */ |
|
39 | - public function register() |
|
40 | - { |
|
41 | - $this->mergeConfigFrom( |
|
42 | - __DIR__.'/../config/skeleton.php', |
|
43 | - 'skeleton' |
|
44 | - ); |
|
45 | - } |
|
34 | + /** |
|
35 | + * Register any package services. |
|
36 | + * |
|
37 | + * @return void |
|
38 | + */ |
|
39 | + public function register() |
|
40 | + { |
|
41 | + $this->mergeConfigFrom( |
|
42 | + __DIR__.'/../config/skeleton.php', |
|
43 | + 'skeleton' |
|
44 | + ); |
|
45 | + } |
|
46 | 46 | } |
@@ -6,62 +6,62 @@ |
||
6 | 6 | class AclUserObserver |
7 | 7 | { |
8 | 8 | |
9 | - public function saving($model) |
|
10 | - { |
|
11 | - if ($model->isDirty('profile_picture')) { |
|
12 | - \Media::deleteImage($model->getOriginal('profile_picture')); |
|
13 | - } |
|
14 | - } |
|
9 | + public function saving($model) |
|
10 | + { |
|
11 | + if ($model->isDirty('profile_picture')) { |
|
12 | + \Media::deleteImage($model->getOriginal('profile_picture')); |
|
13 | + } |
|
14 | + } |
|
15 | 15 | |
16 | - public function saved($model) |
|
17 | - { |
|
18 | - // |
|
19 | - } |
|
16 | + public function saved($model) |
|
17 | + { |
|
18 | + // |
|
19 | + } |
|
20 | 20 | |
21 | - public function creating($model) |
|
22 | - { |
|
23 | - // |
|
24 | - } |
|
21 | + public function creating($model) |
|
22 | + { |
|
23 | + // |
|
24 | + } |
|
25 | 25 | |
26 | - public function created($model) |
|
27 | - { |
|
28 | - // |
|
29 | - } |
|
26 | + public function created($model) |
|
27 | + { |
|
28 | + // |
|
29 | + } |
|
30 | 30 | |
31 | - public function updating($model) |
|
32 | - { |
|
33 | - // |
|
34 | - } |
|
31 | + public function updating($model) |
|
32 | + { |
|
33 | + // |
|
34 | + } |
|
35 | 35 | |
36 | - public function updated($model) |
|
37 | - { |
|
38 | - if ($model->isDirty('blocked') && $model->blocked) { |
|
39 | - $model->tokens()->each(function ($token) { |
|
36 | + public function updated($model) |
|
37 | + { |
|
38 | + if ($model->isDirty('blocked') && $model->blocked) { |
|
39 | + $model->tokens()->each(function ($token) { |
|
40 | 40 | |
41 | - \Core::users()->revokeAccessToken($token); |
|
42 | - }); |
|
43 | - } |
|
44 | - } |
|
41 | + \Core::users()->revokeAccessToken($token); |
|
42 | + }); |
|
43 | + } |
|
44 | + } |
|
45 | 45 | |
46 | - public function deleting($model) |
|
47 | - { |
|
48 | - if ($model->getOriginal('id') == \Auth::id()) { |
|
49 | - \ErrorHandler::noPermissions(); |
|
50 | - } |
|
51 | - } |
|
46 | + public function deleting($model) |
|
47 | + { |
|
48 | + if ($model->getOriginal('id') == \Auth::id()) { |
|
49 | + \ErrorHandler::noPermissions(); |
|
50 | + } |
|
51 | + } |
|
52 | 52 | |
53 | - public function deleted($model) |
|
54 | - { |
|
55 | - // |
|
56 | - } |
|
53 | + public function deleted($model) |
|
54 | + { |
|
55 | + // |
|
56 | + } |
|
57 | 57 | |
58 | - public function restoring($model) |
|
59 | - { |
|
60 | - // |
|
61 | - } |
|
58 | + public function restoring($model) |
|
59 | + { |
|
60 | + // |
|
61 | + } |
|
62 | 62 | |
63 | - public function restored($model) |
|
64 | - { |
|
65 | - // |
|
66 | - } |
|
63 | + public function restored($model) |
|
64 | + { |
|
65 | + // |
|
66 | + } |
|
67 | 67 | } |
@@ -15,31 +15,31 @@ |
||
15 | 15 | |
16 | 16 | Route::group(['prefix' => 'users'], function () { |
17 | 17 | |
18 | - Route::get('/', 'UserController@index'); |
|
19 | - Route::get('/{id}', 'UserController@find'); |
|
20 | - Route::post('/', 'UserController@insert'); |
|
21 | - Route::put('/', 'UserController@update'); |
|
22 | - Route::delete('/{id}', 'UserController@delete'); |
|
23 | - Route::get('list/deleted', 'UserController@deleted'); |
|
24 | - Route::patch('restore/{id}', 'UserController@restore'); |
|
25 | - Route::get('block/{id}', 'UserController@block'); |
|
26 | - Route::get('unblock/{id}', 'UserController@unblock'); |
|
27 | - Route::post('assign/groups', 'UserController@assignGroups'); |
|
28 | - Route::post('group/{groupName}', 'UserController@group'); |
|
18 | + Route::get('/', 'UserController@index'); |
|
19 | + Route::get('/{id}', 'UserController@find'); |
|
20 | + Route::post('/', 'UserController@insert'); |
|
21 | + Route::put('/', 'UserController@update'); |
|
22 | + Route::delete('/{id}', 'UserController@delete'); |
|
23 | + Route::get('list/deleted', 'UserController@deleted'); |
|
24 | + Route::patch('restore/{id}', 'UserController@restore'); |
|
25 | + Route::get('block/{id}', 'UserController@block'); |
|
26 | + Route::get('unblock/{id}', 'UserController@unblock'); |
|
27 | + Route::post('assign/groups', 'UserController@assignGroups'); |
|
28 | + Route::post('group/{groupName}', 'UserController@group'); |
|
29 | 29 | |
30 | - Route::group(['prefix' => 'account'], function () { |
|
30 | + Route::group(['prefix' => 'account'], function () { |
|
31 | 31 | |
32 | - Route::get('my', 'UserController@account'); |
|
33 | - Route::get('logout', 'UserController@logout'); |
|
34 | - Route::post('refresh/token', 'UserController@refreshToken'); |
|
35 | - Route::post('save', 'UserController@saveProfile'); |
|
36 | - Route::post('register', 'UserController@register'); |
|
37 | - Route::post('login', 'UserController@login'); |
|
38 | - Route::post('login/social', 'UserController@loginSocial'); |
|
39 | - Route::post('send/reset', 'UserController@sendReset'); |
|
40 | - Route::post('reset/password', 'UserController@resetPassword'); |
|
41 | - Route::post('change/password', 'UserController@changePassword'); |
|
42 | - Route::post('confirm/email', 'UserController@confirmEmail'); |
|
43 | - Route::post('resend/email/confirmation', 'UserController@resendEmailConfirmation'); |
|
44 | - }); |
|
32 | + Route::get('my', 'UserController@account'); |
|
33 | + Route::get('logout', 'UserController@logout'); |
|
34 | + Route::post('refresh/token', 'UserController@refreshToken'); |
|
35 | + Route::post('save', 'UserController@saveProfile'); |
|
36 | + Route::post('register', 'UserController@register'); |
|
37 | + Route::post('login', 'UserController@login'); |
|
38 | + Route::post('login/social', 'UserController@loginSocial'); |
|
39 | + Route::post('send/reset', 'UserController@sendReset'); |
|
40 | + Route::post('reset/password', 'UserController@resetPassword'); |
|
41 | + Route::post('change/password', 'UserController@changePassword'); |
|
42 | + Route::post('confirm/email', 'UserController@confirmEmail'); |
|
43 | + Route::post('resend/email/confirmation', 'UserController@resendEmailConfirmation'); |
|
44 | + }); |
|
45 | 45 | }); |
@@ -6,27 +6,27 @@ |
||
6 | 6 | |
7 | 7 | class ModuleServiceProvider extends ServiceProvider |
8 | 8 | { |
9 | - /** |
|
10 | - * Bootstrap the module services. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function boot() |
|
15 | - { |
|
16 | - $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'users'); |
|
17 | - $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'users'); |
|
9 | + /** |
|
10 | + * Bootstrap the module services. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function boot() |
|
15 | + { |
|
16 | + $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'users'); |
|
17 | + $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'users'); |
|
18 | 18 | |
19 | - $this->loadMigrationsFrom(module_path('users', 'Database/Migrations', 'app')); |
|
20 | - $this->loadFactoriesFrom(module_path('users', 'Database/Factories', 'app')); |
|
21 | - } |
|
19 | + $this->loadMigrationsFrom(module_path('users', 'Database/Migrations', 'app')); |
|
20 | + $this->loadFactoriesFrom(module_path('users', 'Database/Factories', 'app')); |
|
21 | + } |
|
22 | 22 | |
23 | - /** |
|
24 | - * Register the module services. |
|
25 | - * |
|
26 | - * @return void |
|
27 | - */ |
|
28 | - public function register() |
|
29 | - { |
|
30 | - $this->app->register(RouteServiceProvider::class); |
|
31 | - } |
|
23 | + /** |
|
24 | + * Register the module services. |
|
25 | + * |
|
26 | + * @return void |
|
27 | + */ |
|
28 | + public function register() |
|
29 | + { |
|
30 | + $this->app->register(RouteServiceProvider::class); |
|
31 | + } |
|
32 | 32 | } |
@@ -7,73 +7,73 @@ |
||
7 | 7 | |
8 | 8 | class RouteServiceProvider extends ServiceProvider |
9 | 9 | { |
10 | - /** |
|
11 | - * This namespace is applied to your controller routes. |
|
12 | - * |
|
13 | - * In addition, it is set as the URL generator's root namespace. |
|
14 | - * |
|
15 | - * @var string |
|
16 | - */ |
|
17 | - protected $namespace = 'App\Modules\Users\Http\Controllers'; |
|
10 | + /** |
|
11 | + * This namespace is applied to your controller routes. |
|
12 | + * |
|
13 | + * In addition, it is set as the URL generator's root namespace. |
|
14 | + * |
|
15 | + * @var string |
|
16 | + */ |
|
17 | + protected $namespace = 'App\Modules\Users\Http\Controllers'; |
|
18 | 18 | |
19 | - /** |
|
20 | - * Define your route model bindings, pattern filters, etc. |
|
21 | - * |
|
22 | - * @return void |
|
23 | - */ |
|
24 | - public function boot() |
|
25 | - { |
|
26 | - // |
|
19 | + /** |
|
20 | + * Define your route model bindings, pattern filters, etc. |
|
21 | + * |
|
22 | + * @return void |
|
23 | + */ |
|
24 | + public function boot() |
|
25 | + { |
|
26 | + // |
|
27 | 27 | |
28 | - parent::boot(); |
|
29 | - } |
|
28 | + parent::boot(); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Define the routes for the module. |
|
33 | - * |
|
34 | - * @return void |
|
35 | - */ |
|
36 | - public function map() |
|
37 | - { |
|
38 | - $this->mapWebRoutes(); |
|
31 | + /** |
|
32 | + * Define the routes for the module. |
|
33 | + * |
|
34 | + * @return void |
|
35 | + */ |
|
36 | + public function map() |
|
37 | + { |
|
38 | + $this->mapWebRoutes(); |
|
39 | 39 | |
40 | - $this->mapApiRoutes(); |
|
40 | + $this->mapApiRoutes(); |
|
41 | 41 | |
42 | - // |
|
43 | - } |
|
42 | + // |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * Define the "web" routes for the module. |
|
47 | - * |
|
48 | - * These routes all receive session state, CSRF protection, etc. |
|
49 | - * |
|
50 | - * @return void |
|
51 | - */ |
|
52 | - protected function mapWebRoutes() |
|
53 | - { |
|
54 | - Route::group([ |
|
55 | - 'middleware' => 'web', |
|
56 | - 'namespace' => $this->namespace, |
|
57 | - ], function ($router) { |
|
58 | - require module_path('users', 'Routes/web.php', 'app'); |
|
59 | - }); |
|
60 | - } |
|
45 | + /** |
|
46 | + * Define the "web" routes for the module. |
|
47 | + * |
|
48 | + * These routes all receive session state, CSRF protection, etc. |
|
49 | + * |
|
50 | + * @return void |
|
51 | + */ |
|
52 | + protected function mapWebRoutes() |
|
53 | + { |
|
54 | + Route::group([ |
|
55 | + 'middleware' => 'web', |
|
56 | + 'namespace' => $this->namespace, |
|
57 | + ], function ($router) { |
|
58 | + require module_path('users', 'Routes/web.php', 'app'); |
|
59 | + }); |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * Define the "api" routes for the module. |
|
64 | - * |
|
65 | - * These routes are typically stateless. |
|
66 | - * |
|
67 | - * @return void |
|
68 | - */ |
|
69 | - protected function mapApiRoutes() |
|
70 | - { |
|
71 | - Route::group([ |
|
72 | - 'middleware' => 'api', |
|
73 | - 'namespace' => $this->namespace, |
|
74 | - 'prefix' => 'api', |
|
75 | - ], function ($router) { |
|
76 | - require module_path('users', 'Routes/api.php', 'app'); |
|
77 | - }); |
|
78 | - } |
|
62 | + /** |
|
63 | + * Define the "api" routes for the module. |
|
64 | + * |
|
65 | + * These routes are typically stateless. |
|
66 | + * |
|
67 | + * @return void |
|
68 | + */ |
|
69 | + protected function mapApiRoutes() |
|
70 | + { |
|
71 | + Route::group([ |
|
72 | + 'middleware' => 'api', |
|
73 | + 'namespace' => $this->namespace, |
|
74 | + 'prefix' => 'api', |
|
75 | + ], function ($router) { |
|
76 | + require module_path('users', 'Routes/api.php', 'app'); |
|
77 | + }); |
|
78 | + } |
|
79 | 79 | } |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | $factory->define(App\Modules\Users\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 | }); |
@@ -6,88 +6,88 @@ |
||
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' => 'index', |
|
26 | - 'model' => 'user', |
|
27 | - 'created_at' => \DB::raw('NOW()'), |
|
28 | - 'updated_at' => \DB::raw('NOW()') |
|
29 | - ], |
|
30 | - [ |
|
31 | - 'name' => 'find', |
|
32 | - 'model' => 'user', |
|
33 | - 'created_at' => \DB::raw('NOW()'), |
|
34 | - 'updated_at' => \DB::raw('NOW()') |
|
35 | - ], |
|
36 | - [ |
|
37 | - 'name' => 'insert', |
|
38 | - 'model' => 'user', |
|
39 | - 'created_at' => \DB::raw('NOW()'), |
|
40 | - 'updated_at' => \DB::raw('NOW()') |
|
41 | - ], |
|
42 | - [ |
|
43 | - 'name' => 'update', |
|
44 | - 'model' => 'user', |
|
45 | - 'created_at' => \DB::raw('NOW()'), |
|
46 | - 'updated_at' => \DB::raw('NOW()') |
|
47 | - ], |
|
48 | - [ |
|
49 | - 'name' => 'delete', |
|
50 | - 'model' => 'user', |
|
51 | - 'created_at' => \DB::raw('NOW()'), |
|
52 | - 'updated_at' => \DB::raw('NOW()') |
|
53 | - ], |
|
54 | - [ |
|
55 | - 'name' => 'deleted', |
|
56 | - 'model' => 'user', |
|
57 | - 'created_at' => \DB::raw('NOW()'), |
|
58 | - 'updated_at' => \DB::raw('NOW()') |
|
59 | - ], |
|
60 | - [ |
|
61 | - 'name' => 'restore', |
|
62 | - 'model' => 'user', |
|
63 | - 'created_at' => \DB::raw('NOW()'), |
|
64 | - 'updated_at' => \DB::raw('NOW()') |
|
65 | - ], |
|
66 | - [ |
|
67 | - 'name' => 'assignGroups', |
|
68 | - 'model' => 'user', |
|
69 | - 'created_at' => \DB::raw('NOW()'), |
|
70 | - 'updated_at' => \DB::raw('NOW()') |
|
71 | - ], |
|
72 | - [ |
|
73 | - 'name' => 'block', |
|
74 | - 'model' => 'user', |
|
75 | - 'created_at' => \DB::raw('NOW()'), |
|
76 | - 'updated_at' => \DB::raw('NOW()') |
|
77 | - ], |
|
78 | - [ |
|
79 | - 'name' => 'unblock', |
|
80 | - 'model' => 'user', |
|
81 | - 'created_at' => \DB::raw('NOW()'), |
|
82 | - 'updated_at' => \DB::raw('NOW()') |
|
83 | - ], |
|
84 | - [ |
|
85 | - 'name' => 'group', |
|
86 | - 'model' => 'user', |
|
87 | - 'created_at' => \DB::raw('NOW()'), |
|
88 | - 'updated_at' => \DB::raw('NOW()') |
|
89 | - ] |
|
90 | - ] |
|
91 | - ); |
|
92 | - } |
|
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' => 'index', |
|
26 | + 'model' => 'user', |
|
27 | + 'created_at' => \DB::raw('NOW()'), |
|
28 | + 'updated_at' => \DB::raw('NOW()') |
|
29 | + ], |
|
30 | + [ |
|
31 | + 'name' => 'find', |
|
32 | + 'model' => 'user', |
|
33 | + 'created_at' => \DB::raw('NOW()'), |
|
34 | + 'updated_at' => \DB::raw('NOW()') |
|
35 | + ], |
|
36 | + [ |
|
37 | + 'name' => 'insert', |
|
38 | + 'model' => 'user', |
|
39 | + 'created_at' => \DB::raw('NOW()'), |
|
40 | + 'updated_at' => \DB::raw('NOW()') |
|
41 | + ], |
|
42 | + [ |
|
43 | + 'name' => 'update', |
|
44 | + 'model' => 'user', |
|
45 | + 'created_at' => \DB::raw('NOW()'), |
|
46 | + 'updated_at' => \DB::raw('NOW()') |
|
47 | + ], |
|
48 | + [ |
|
49 | + 'name' => 'delete', |
|
50 | + 'model' => 'user', |
|
51 | + 'created_at' => \DB::raw('NOW()'), |
|
52 | + 'updated_at' => \DB::raw('NOW()') |
|
53 | + ], |
|
54 | + [ |
|
55 | + 'name' => 'deleted', |
|
56 | + 'model' => 'user', |
|
57 | + 'created_at' => \DB::raw('NOW()'), |
|
58 | + 'updated_at' => \DB::raw('NOW()') |
|
59 | + ], |
|
60 | + [ |
|
61 | + 'name' => 'restore', |
|
62 | + 'model' => 'user', |
|
63 | + 'created_at' => \DB::raw('NOW()'), |
|
64 | + 'updated_at' => \DB::raw('NOW()') |
|
65 | + ], |
|
66 | + [ |
|
67 | + 'name' => 'assignGroups', |
|
68 | + 'model' => 'user', |
|
69 | + 'created_at' => \DB::raw('NOW()'), |
|
70 | + 'updated_at' => \DB::raw('NOW()') |
|
71 | + ], |
|
72 | + [ |
|
73 | + 'name' => 'block', |
|
74 | + 'model' => 'user', |
|
75 | + 'created_at' => \DB::raw('NOW()'), |
|
76 | + 'updated_at' => \DB::raw('NOW()') |
|
77 | + ], |
|
78 | + [ |
|
79 | + 'name' => 'unblock', |
|
80 | + 'model' => 'user', |
|
81 | + 'created_at' => \DB::raw('NOW()'), |
|
82 | + 'updated_at' => \DB::raw('NOW()') |
|
83 | + ], |
|
84 | + [ |
|
85 | + 'name' => 'group', |
|
86 | + 'model' => 'user', |
|
87 | + 'created_at' => \DB::raw('NOW()'), |
|
88 | + 'updated_at' => \DB::raw('NOW()') |
|
89 | + ] |
|
90 | + ] |
|
91 | + ); |
|
92 | + } |
|
93 | 93 | } |
@@ -6,15 +6,15 @@ |
||
6 | 6 | |
7 | 7 | class UsersDatabaseSeeder extends Seeder |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the database seeds. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function run() |
|
15 | - { |
|
16 | - $this->call(ClearDataSeeder::class); |
|
17 | - $this->call(UsersTableSeeder::class); |
|
18 | - $this->call(AssignRelationsSeeder::class); |
|
19 | - } |
|
9 | + /** |
|
10 | + * Run the database seeds. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function run() |
|
15 | + { |
|
16 | + $this->call(ClearDataSeeder::class); |
|
17 | + $this->call(UsersTableSeeder::class); |
|
18 | + $this->call(AssignRelationsSeeder::class); |
|
19 | + } |
|
20 | 20 | } |
@@ -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', ['user'])->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', ['user'])->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 | } |