@@ -5,14 +5,14 @@ |
||
5 | 5 | |
6 | 6 | class DummyRepository extends BaseRepository |
7 | 7 | { |
8 | - /** |
|
9 | - * Init new object. |
|
10 | - * |
|
11 | - * @param DummyModel $model |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function __construct(DummyModel $model) |
|
15 | - { |
|
16 | - parent::__construct($model); |
|
17 | - } |
|
8 | + /** |
|
9 | + * Init new object. |
|
10 | + * |
|
11 | + * @param DummyModel $model |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function __construct(DummyModel $model) |
|
15 | + { |
|
16 | + parent::__construct($model); |
|
17 | + } |
|
18 | 18 | } |
@@ -6,15 +6,15 @@ |
||
6 | 6 | |
7 | 7 | class NotificationsDatabaseSeeder 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(NotificationsTableSeeder::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(NotificationsTableSeeder::class); |
|
18 | + $this->call(AssignRelationsSeeder::class); |
|
19 | + } |
|
20 | 20 | } |
@@ -6,15 +6,15 @@ |
||
6 | 6 | |
7 | 7 | class RolesDatabaseSeeder 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(RolesTableSeeder::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(RolesTableSeeder::class); |
|
18 | + $this->call(AssignRelationsSeeder::class); |
|
19 | + } |
|
20 | 20 | } |
@@ -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', 'roles'); |
|
17 | - $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'roles'); |
|
9 | + /** |
|
10 | + * Bootstrap the module services. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function boot() |
|
15 | + { |
|
16 | + $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'roles'); |
|
17 | + $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'roles'); |
|
18 | 18 | |
19 | - $this->loadMigrationsFrom(module_path('roles', 'Database/Migrations', 'app')); |
|
20 | - $this->loadFactoriesFrom(module_path('roles', 'Database/Factories', 'app')); |
|
21 | - } |
|
19 | + $this->loadMigrationsFrom(module_path('roles', 'Database/Migrations', 'app')); |
|
20 | + $this->loadFactoriesFrom(module_path('roles', '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\Roles\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\Roles\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('roles', '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('roles', '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('roles', '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('roles', 'Routes/api.php', 'app'); |
|
77 | + }); |
|
78 | + } |
|
79 | 79 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | Route::group([ |
55 | 55 | 'middleware' => 'web', |
56 | 56 | 'namespace' => $this->namespace, |
57 | - ], function ($router) { |
|
57 | + ], function($router) { |
|
58 | 58 | require module_path('roles', 'Routes/web.php', 'app'); |
59 | 59 | }); |
60 | 60 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | 'middleware' => 'api', |
73 | 73 | 'namespace' => $this->namespace, |
74 | 74 | 'prefix' => 'api', |
75 | - ], function ($router) { |
|
75 | + ], function($router) { |
|
76 | 76 | require module_path('roles', 'Routes/api.php', 'app'); |
77 | 77 | }); |
78 | 78 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | */ |
18 | 18 | public function toArray($request) |
19 | 19 | { |
20 | - if (! $this->resource) { |
|
20 | + if ( ! $this->resource) { |
|
21 | 21 | return []; |
22 | 22 | } |
23 | 23 |
@@ -8,25 +8,25 @@ |
||
8 | 8 | |
9 | 9 | class Role extends JsonResource |
10 | 10 | { |
11 | - /** |
|
12 | - * Transform the resource into an array. |
|
13 | - * |
|
14 | - * @param Request $request |
|
15 | - * @return array |
|
16 | - */ |
|
17 | - public function toArray($request) |
|
18 | - { |
|
19 | - if (! $this->resource) { |
|
20 | - return []; |
|
21 | - } |
|
11 | + /** |
|
12 | + * Transform the resource into an array. |
|
13 | + * |
|
14 | + * @param Request $request |
|
15 | + * @return array |
|
16 | + */ |
|
17 | + public function toArray($request) |
|
18 | + { |
|
19 | + if (! $this->resource) { |
|
20 | + return []; |
|
21 | + } |
|
22 | 22 | |
23 | - return [ |
|
24 | - 'id' => $this->id, |
|
25 | - 'name' => $this->name, |
|
26 | - 'users' => UserResource::collection($this->whenLoaded('users')), |
|
27 | - 'permissions' => PermissionResource::collection($this->whenLoaded('permissions')), |
|
28 | - 'created_at' => $this->created_at, |
|
29 | - 'updated_at' => $this->updated_at, |
|
30 | - ]; |
|
31 | - } |
|
23 | + return [ |
|
24 | + 'id' => $this->id, |
|
25 | + 'name' => $this->name, |
|
26 | + 'users' => UserResource::collection($this->whenLoaded('users')), |
|
27 | + 'permissions' => PermissionResource::collection($this->whenLoaded('permissions')), |
|
28 | + 'created_at' => $this->created_at, |
|
29 | + 'updated_at' => $this->updated_at, |
|
30 | + ]; |
|
31 | + } |
|
32 | 32 | } |
@@ -16,7 +16,6 @@ |
||
16 | 16 | * |
17 | 17 | * @param Session $session |
18 | 18 | * @param Auth $auth |
19 | - * @param ErrorHandler $errorHandler |
|
20 | 19 | * |
21 | 20 | * @return void |
22 | 21 | */ |
@@ -8,53 +8,53 @@ |
||
8 | 8 | |
9 | 9 | class UpdateLocaleAndTimezone |
10 | 10 | { |
11 | - protected $session; |
|
12 | - protected $auth; |
|
11 | + protected $session; |
|
12 | + protected $auth; |
|
13 | 13 | |
14 | - /** |
|
15 | - * Init new object. |
|
16 | - * |
|
17 | - * @param Session $session |
|
18 | - * @param Auth $auth |
|
19 | - * @param ErrorHandler $errorHandler |
|
20 | - * |
|
21 | - * @return void |
|
22 | - */ |
|
23 | - public function __construct(Session $session, Auth $auth) |
|
24 | - { |
|
25 | - $this->session = $session; |
|
26 | - $this->auth = $auth; |
|
27 | - } |
|
14 | + /** |
|
15 | + * Init new object. |
|
16 | + * |
|
17 | + * @param Session $session |
|
18 | + * @param Auth $auth |
|
19 | + * @param ErrorHandler $errorHandler |
|
20 | + * |
|
21 | + * @return void |
|
22 | + */ |
|
23 | + public function __construct(Session $session, Auth $auth) |
|
24 | + { |
|
25 | + $this->session = $session; |
|
26 | + $this->auth = $auth; |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * Handle an incoming request. |
|
31 | - * |
|
32 | - * @param \Illuminate\Http\Request $request |
|
33 | - * @param \Closure $next |
|
34 | - * @return mixed |
|
35 | - */ |
|
36 | - public function handle($request, Closure $next) |
|
37 | - { |
|
38 | - $update = false; |
|
39 | - $user = $this->auth->user(); |
|
40 | - if ($user) { |
|
41 | - $locale = $this->session->get('locale'); |
|
42 | - $timezone = $this->session->get('time-zone'); |
|
43 | - if ($locale && $locale !== 'all' && $locale !== $user->locale) { |
|
44 | - $user->locale = $locale; |
|
45 | - $update = true; |
|
46 | - } |
|
29 | + /** |
|
30 | + * Handle an incoming request. |
|
31 | + * |
|
32 | + * @param \Illuminate\Http\Request $request |
|
33 | + * @param \Closure $next |
|
34 | + * @return mixed |
|
35 | + */ |
|
36 | + public function handle($request, Closure $next) |
|
37 | + { |
|
38 | + $update = false; |
|
39 | + $user = $this->auth->user(); |
|
40 | + if ($user) { |
|
41 | + $locale = $this->session->get('locale'); |
|
42 | + $timezone = $this->session->get('time-zone'); |
|
43 | + if ($locale && $locale !== 'all' && $locale !== $user->locale) { |
|
44 | + $user->locale = $locale; |
|
45 | + $update = true; |
|
46 | + } |
|
47 | 47 | |
48 | - if ($timezone && $timezone !== $user->timezone) { |
|
49 | - $user->timezone = $timezone; |
|
50 | - $update = true; |
|
51 | - } |
|
48 | + if ($timezone && $timezone !== $user->timezone) { |
|
49 | + $user->timezone = $timezone; |
|
50 | + $update = true; |
|
51 | + } |
|
52 | 52 | |
53 | - if ($update) { |
|
54 | - $user->save(); |
|
55 | - } |
|
56 | - } |
|
53 | + if ($update) { |
|
54 | + $user->save(); |
|
55 | + } |
|
56 | + } |
|
57 | 57 | |
58 | - return $next($request); |
|
59 | - } |
|
58 | + return $next($request); |
|
59 | + } |
|
60 | 60 | } |
@@ -47,7 +47,7 @@ |
||
47 | 47 | |
48 | 48 | if ($timezone && $timezone !== $user->timezone) { |
49 | 49 | $user->timezone = $timezone; |
50 | - $update = true; |
|
50 | + $update = true; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | if ($update) { |
@@ -10,54 +10,54 @@ |
||
10 | 10 | |
11 | 11 | class PushNotificationDeviceController extends BaseApiController |
12 | 12 | { |
13 | - /** |
|
14 | - * List of all route actions that the base api controller |
|
15 | - * will skip permissions check for them. |
|
16 | - * @var array |
|
17 | - */ |
|
18 | - protected $skipPermissionCheck = ['registerDevice']; |
|
13 | + /** |
|
14 | + * List of all route actions that the base api controller |
|
15 | + * will skip permissions check for them. |
|
16 | + * @var array |
|
17 | + */ |
|
18 | + protected $skipPermissionCheck = ['registerDevice']; |
|
19 | 19 | |
20 | - /** |
|
21 | - * Init new object. |
|
22 | - * |
|
23 | - * @param PushNotificationDeviceRepository $repo |
|
24 | - * @return void |
|
25 | - */ |
|
26 | - public function __construct(PushNotificationDeviceRepository $repo) |
|
27 | - { |
|
28 | - parent::__construct($repo, 'App\Modules\PushNotificationDevices\Http\Resources\PushNotificationDevice'); |
|
29 | - } |
|
20 | + /** |
|
21 | + * Init new object. |
|
22 | + * |
|
23 | + * @param PushNotificationDeviceRepository $repo |
|
24 | + * @return void |
|
25 | + */ |
|
26 | + public function __construct(PushNotificationDeviceRepository $repo) |
|
27 | + { |
|
28 | + parent::__construct($repo, 'App\Modules\PushNotificationDevices\Http\Resources\PushNotificationDevice'); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Insert the given model to storage. |
|
33 | - * |
|
34 | - * @param InsertPushNotificationDevice $request |
|
35 | - * @return \Illuminate\Http\Response |
|
36 | - */ |
|
37 | - public function insert(InsertPushNotificationDevice $request) |
|
38 | - { |
|
39 | - return new $this->modelResource($this->repo->save($request->all())); |
|
40 | - } |
|
31 | + /** |
|
32 | + * Insert the given model to storage. |
|
33 | + * |
|
34 | + * @param InsertPushNotificationDevice $request |
|
35 | + * @return \Illuminate\Http\Response |
|
36 | + */ |
|
37 | + public function insert(InsertPushNotificationDevice $request) |
|
38 | + { |
|
39 | + return new $this->modelResource($this->repo->save($request->all())); |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * Update the given model to storage. |
|
44 | - * |
|
45 | - * @param UpdatePushNotificationDevice $request |
|
46 | - * @return \Illuminate\Http\Response |
|
47 | - */ |
|
48 | - public function update(UpdatePushNotificationDevice $request) |
|
49 | - { |
|
50 | - return new $this->modelResource($this->repo->save($request->all())); |
|
51 | - } |
|
42 | + /** |
|
43 | + * Update the given model to storage. |
|
44 | + * |
|
45 | + * @param UpdatePushNotificationDevice $request |
|
46 | + * @return \Illuminate\Http\Response |
|
47 | + */ |
|
48 | + public function update(UpdatePushNotificationDevice $request) |
|
49 | + { |
|
50 | + return new $this->modelResource($this->repo->save($request->all())); |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * Register the given device to the logged in user. |
|
55 | - * |
|
56 | - * @param RegisterDevice $request |
|
57 | - * @return \Illuminate\Http\Response |
|
58 | - */ |
|
59 | - public function registerDevice(RegisterDevice $request) |
|
60 | - { |
|
61 | - return new $this->modelResource($this->repo->registerDevice($request->all())); |
|
62 | - } |
|
53 | + /** |
|
54 | + * Register the given device to the logged in user. |
|
55 | + * |
|
56 | + * @param RegisterDevice $request |
|
57 | + * @return \Illuminate\Http\Response |
|
58 | + */ |
|
59 | + public function registerDevice(RegisterDevice $request) |
|
60 | + { |
|
61 | + return new $this->modelResource($this->repo->registerDevice($request->all())); |
|
62 | + } |
|
63 | 63 | } |
@@ -8,56 +8,56 @@ |
||
8 | 8 | |
9 | 9 | class SetSessions |
10 | 10 | { |
11 | - protected $app; |
|
12 | - protected $session; |
|
11 | + protected $app; |
|
12 | + protected $session; |
|
13 | 13 | |
14 | - /** |
|
15 | - * Init new object. |
|
16 | - * |
|
17 | - * @param App $app |
|
18 | - * @param Session $session |
|
19 | - * |
|
20 | - * @return void |
|
21 | - */ |
|
22 | - public function __construct(App $app, Session $session) |
|
23 | - { |
|
24 | - $this->app = $app; |
|
25 | - $this->session = $session; |
|
26 | - } |
|
27 | - |
|
28 | - /** |
|
29 | - * Handle an incoming request. |
|
30 | - * |
|
31 | - * @param \Illuminate\Http\Request $request |
|
32 | - * @param \Closure $next |
|
33 | - * @return mixed |
|
34 | - */ |
|
35 | - public function handle($request, Closure $next) |
|
36 | - { |
|
37 | - $this->session->put('time-zone', $request->header('time-zone') ?: 0); |
|
38 | - |
|
39 | - $locale = $request->header('locale'); |
|
40 | - switch ($locale) { |
|
41 | - case 'en': |
|
42 | - $this->app->setLocale('en'); |
|
43 | - $this->session->put('locale', 'en'); |
|
44 | - break; |
|
45 | - |
|
46 | - case 'ar': |
|
47 | - $this->app->setLocale('ar'); |
|
48 | - $this->session->put('locale', 'ar'); |
|
49 | - break; |
|
50 | - |
|
51 | - case 'all': |
|
52 | - $this->app->setLocale('en'); |
|
53 | - $this->session->put('locale', 'all'); |
|
54 | - break; |
|
55 | - |
|
56 | - default: |
|
57 | - $this->app->setLocale('en'); |
|
58 | - $this->session->put('locale', 'en'); |
|
59 | - break; |
|
60 | - } |
|
61 | - return $next($request); |
|
62 | - } |
|
14 | + /** |
|
15 | + * Init new object. |
|
16 | + * |
|
17 | + * @param App $app |
|
18 | + * @param Session $session |
|
19 | + * |
|
20 | + * @return void |
|
21 | + */ |
|
22 | + public function __construct(App $app, Session $session) |
|
23 | + { |
|
24 | + $this->app = $app; |
|
25 | + $this->session = $session; |
|
26 | + } |
|
27 | + |
|
28 | + /** |
|
29 | + * Handle an incoming request. |
|
30 | + * |
|
31 | + * @param \Illuminate\Http\Request $request |
|
32 | + * @param \Closure $next |
|
33 | + * @return mixed |
|
34 | + */ |
|
35 | + public function handle($request, Closure $next) |
|
36 | + { |
|
37 | + $this->session->put('time-zone', $request->header('time-zone') ?: 0); |
|
38 | + |
|
39 | + $locale = $request->header('locale'); |
|
40 | + switch ($locale) { |
|
41 | + case 'en': |
|
42 | + $this->app->setLocale('en'); |
|
43 | + $this->session->put('locale', 'en'); |
|
44 | + break; |
|
45 | + |
|
46 | + case 'ar': |
|
47 | + $this->app->setLocale('ar'); |
|
48 | + $this->session->put('locale', 'ar'); |
|
49 | + break; |
|
50 | + |
|
51 | + case 'all': |
|
52 | + $this->app->setLocale('en'); |
|
53 | + $this->session->put('locale', 'all'); |
|
54 | + break; |
|
55 | + |
|
56 | + default: |
|
57 | + $this->app->setLocale('en'); |
|
58 | + $this->session->put('locale', 'en'); |
|
59 | + break; |
|
60 | + } |
|
61 | + return $next($request); |
|
62 | + } |
|
63 | 63 | } |