Completed
Push — master ( 60eb24...8a761d )
by Sherif
01:58
created
Http/Controllers/PushNotificationDeviceController.php 1 patch
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -8,46 +8,46 @@
 block discarded – undo
8 8
 
9 9
 class PushNotificationDeviceController extends BaseApiController
10 10
 {
11
-    /**
12
-     * Path of the sotre form request.
13
-     *
14
-     * @var string
15
-     */
16
-    protected $storeFormRequest = 'App\Modules\Users\Http\PushNotificationDevices\StorePushNotificationDevice';
11
+	/**
12
+	 * Path of the sotre form request.
13
+	 *
14
+	 * @var string
15
+	 */
16
+	protected $storeFormRequest = 'App\Modules\Users\Http\PushNotificationDevices\StorePushNotificationDevice';
17 17
 
18
-    /**
19
-     * Path of the model resource
20
-     *
21
-     * @var string
22
-     */
23
-    protected $modelResource = 'App\Modules\PushNotificationDevices\Http\Resources\PushNotificationDevice';
18
+	/**
19
+	 * Path of the model resource
20
+	 *
21
+	 * @var string
22
+	 */
23
+	protected $modelResource = 'App\Modules\PushNotificationDevices\Http\Resources\PushNotificationDevice';
24 24
 
25
-    /**
26
-     * List of all route actions that the base api controller
27
-     * will skip permissions check for them.
28
-     * @var array
29
-     */
30
-    protected $skipPermissionCheck = ['registerDevice'];
25
+	/**
26
+	 * List of all route actions that the base api controller
27
+	 * will skip permissions check for them.
28
+	 * @var array
29
+	 */
30
+	protected $skipPermissionCheck = ['registerDevice'];
31 31
 
32
-    /**
33
-     * Init new object.
34
-     *
35
-     * @param   PushNotificationDeviceService $service
36
-     * @return  void
37
-     */
38
-    public function __construct(PushNotificationDeviceService $service)
39
-    {
40
-        parent::__construct($service);
41
-    }
32
+	/**
33
+	 * Init new object.
34
+	 *
35
+	 * @param   PushNotificationDeviceService $service
36
+	 * @return  void
37
+	 */
38
+	public function __construct(PushNotificationDeviceService $service)
39
+	{
40
+		parent::__construct($service);
41
+	}
42 42
 
43
-    /**
44
-     * Register the given device to the logged in user.
45
-     *
46
-     * @param RegisterDevice $request
47
-     * @return \Illuminate\Http\Response
48
-     */
49
-    public function registerDevice(RegisterDevice $request)
50
-    {
51
-        return new $this->modelResource($this->service->registerDevice($request->all()));
52
-    }
43
+	/**
44
+	 * Register the given device to the logged in user.
45
+	 *
46
+	 * @param RegisterDevice $request
47
+	 * @return \Illuminate\Http\Response
48
+	 */
49
+	public function registerDevice(RegisterDevice $request)
50
+	{
51
+		return new $this->modelResource($this->service->registerDevice($request->all()));
52
+	}
53 53
 }
Please login to merge, or discard this patch.
PushNotificationDevices/Http/Requests/StorePushNotificationDevice.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -6,26 +6,26 @@
 block discarded – undo
6 6
 
7 7
 class StorePushNotificationDevice extends FormRequest
8 8
 {
9
-    /**
10
-     * Determine if the user is authorized to make this request.
11
-     *
12
-     * @return bool
13
-     */
14
-    public function authorize()
15
-    {
16
-        return true;
17
-    }
9
+	/**
10
+	 * Determine if the user is authorized to make this request.
11
+	 *
12
+	 * @return bool
13
+	 */
14
+	public function authorize()
15
+	{
16
+		return true;
17
+	}
18 18
 
19
-    /**
20
-     * Get the validation rules that apply to the request.
21
-     *
22
-     * @return array
23
-     */
24
-    public function rules()
25
-    {
26
-        return [
27
-            'device_token' => 'required|string|max:255',
28
-            'user_id'      => 'required|exists:users,id'
29
-        ];
30
-    }
19
+	/**
20
+	 * Get the validation rules that apply to the request.
21
+	 *
22
+	 * @return array
23
+	 */
24
+	public function rules()
25
+	{
26
+		return [
27
+			'device_token' => 'required|string|max:255',
28
+			'user_id'      => 'required|exists:users,id'
29
+		];
30
+	}
31 31
 }
Please login to merge, or discard this patch.
src/Modules/Core/Database/Seeds/SettingsTableSeeder.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -6,52 +6,52 @@
 block discarded – undo
6 6
 
7 7
 class SettingsTableSeeder 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 settings table.
18
-         */
19
-        \DB::table('permissions')->insert(
20
-            [
21
-                /**
22
-                 * Settings model permissions.
23
-                 */
24
-                [
25
-                'name'       => 'index',
26
-                'model'      => 'setting',
27
-                'created_at' => \DB::raw('NOW()'),
28
-                'updated_at' => \DB::raw('NOW()')
29
-                ],
30
-                [
31
-                'name'       => 'show',
32
-                'model'      => 'setting',
33
-                'created_at' => \DB::raw('NOW()'),
34
-                'updated_at' => \DB::raw('NOW()')
35
-                ],
36
-                [
37
-                'name'       => 'update',
38
-                'model'      => 'setting',
39
-                'created_at' => \DB::raw('NOW()'),
40
-                'updated_at' => \DB::raw('NOW()')
41
-                ],
42
-                [
43
-                'name'       => 'destroy',
44
-                'model'      => 'setting',
45
-                'created_at' => \DB::raw('NOW()'),
46
-                'updated_at' => \DB::raw('NOW()')
47
-                ],
48
-                [
49
-                'name'       => 'saveMany',
50
-                'model'      => 'setting',
51
-                'created_at' => \DB::raw('NOW()'),
52
-                'updated_at' => \DB::raw('NOW()')
53
-                ]
54
-            ]
55
-        );
56
-    }
9
+	/**
10
+	 * Run the database seeds.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function run()
15
+	{
16
+		/**
17
+		 * Insert the permissions related to settings table.
18
+		 */
19
+		\DB::table('permissions')->insert(
20
+			[
21
+				/**
22
+				 * Settings model permissions.
23
+				 */
24
+				[
25
+				'name'       => 'index',
26
+				'model'      => 'setting',
27
+				'created_at' => \DB::raw('NOW()'),
28
+				'updated_at' => \DB::raw('NOW()')
29
+				],
30
+				[
31
+				'name'       => 'show',
32
+				'model'      => 'setting',
33
+				'created_at' => \DB::raw('NOW()'),
34
+				'updated_at' => \DB::raw('NOW()')
35
+				],
36
+				[
37
+				'name'       => 'update',
38
+				'model'      => 'setting',
39
+				'created_at' => \DB::raw('NOW()'),
40
+				'updated_at' => \DB::raw('NOW()')
41
+				],
42
+				[
43
+				'name'       => 'destroy',
44
+				'model'      => 'setting',
45
+				'created_at' => \DB::raw('NOW()'),
46
+				'updated_at' => \DB::raw('NOW()')
47
+				],
48
+				[
49
+				'name'       => 'saveMany',
50
+				'model'      => 'setting',
51
+				'created_at' => \DB::raw('NOW()'),
52
+				'updated_at' => \DB::raw('NOW()')
53
+				]
54
+			]
55
+		);
56
+	}
57 57
 }
Please login to merge, or discard this patch.
src/Modules/Core/Http/Controllers/SettingController.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -9,39 +9,39 @@
 block discarded – undo
9 9
 
10 10
 class SettingController extends BaseApiController
11 11
 {
12
-    /**
13
-     * Path of the sotre form request.
14
-     *
15
-     * @var string
16
-     */
17
-    protected $storeFormRequest = 'App\Modules\Core\Http\Requests\StoreSetting';
12
+	/**
13
+	 * Path of the sotre form request.
14
+	 *
15
+	 * @var string
16
+	 */
17
+	protected $storeFormRequest = 'App\Modules\Core\Http\Requests\StoreSetting';
18 18
 
19
-    /**
20
-     * Path of the model resource
21
-     *
22
-     * @var string
23
-     */
24
-    protected $modelResource = 'App\Modules\Core\Http\Resources\Setting';
19
+	/**
20
+	 * Path of the model resource
21
+	 *
22
+	 * @var string
23
+	 */
24
+	protected $modelResource = 'App\Modules\Core\Http\Resources\Setting';
25 25
 
26
-    /**
27
-     * Init new object.
28
-     *
29
-     * @param   SettingService $service
30
-     * @return  void
31
-     */
32
-    public function __construct(SettingService $service)
33
-    {
34
-        parent::__construct($service);
35
-    }
26
+	/**
27
+	 * Init new object.
28
+	 *
29
+	 * @param   SettingService $service
30
+	 * @return  void
31
+	 */
32
+	public function __construct(SettingService $service)
33
+	{
34
+		parent::__construct($service);
35
+	}
36 36
 
37
-    /**
38
-     * Save list of settings.
39
-     *
40
-     * @param Request $request
41
-     * @return \Illuminate\Http\Response
42
-     */
43
-    public function saveMany(Request $request)
44
-    {
45
-        return new GeneralResource($this->service->saveMany($request->all()));
46
-    }
37
+	/**
38
+	 * Save list of settings.
39
+	 *
40
+	 * @param Request $request
41
+	 * @return \Illuminate\Http\Response
42
+	 */
43
+	public function saveMany(Request $request)
44
+	{
45
+		return new GeneralResource($this->service->saveMany($request->all()));
46
+	}
47 47
 }
Please login to merge, or discard this patch.
src/Modules/Core/Http/Requests/StoreSetting.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -6,25 +6,25 @@
 block discarded – undo
6 6
 
7 7
 class StoreSetting extends FormRequest
8 8
 {
9
-    /**
10
-     * Determine if the user is authorized to make this request.
11
-     *
12
-     * @return bool
13
-     */
14
-    public function authorize()
15
-    {
16
-        return true;
17
-    }
9
+	/**
10
+	 * Determine if the user is authorized to make this request.
11
+	 *
12
+	 * @return bool
13
+	 */
14
+	public function authorize()
15
+	{
16
+		return true;
17
+	}
18 18
 
19
-    /**
20
-     * Get the validation rules that apply to the request.
21
-     *
22
-     * @return array
23
-     */
24
-    public function rules()
25
-    {
26
-        return [
27
-            'value' => 'required|string'
28
-        ];
29
-    }
19
+	/**
20
+	 * Get the validation rules that apply to the request.
21
+	 *
22
+	 * @return array
23
+	 */
24
+	public function rules()
25
+	{
26
+		return [
27
+			'value' => 'required|string'
28
+		];
29
+	}
30 30
 }
Please login to merge, or discard this patch.
src/Modules/Core/Console/Commands/Stubs/Module/Routes/api.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,10 +15,10 @@
 block discarded – undo
15 15
 
16 16
 Route::group(['prefix' => 'DummyRoutePrefix'], function () {
17 17
 
18
-    Route::get('/', 'DummyController@index');
19
-    Route::get('{id}', 'DummyController@show');
20
-    Route::post('/', 'DummyController@store');
21
-    Route::patch('{id}', 'DummyController@update');
22
-    Route::delete('{id}', 'DummyController@destroy');
23
-    Route::patch('restore/{id}', 'DummyController@restore');
18
+	Route::get('/', 'DummyController@index');
19
+	Route::get('{id}', 'DummyController@show');
20
+	Route::post('/', 'DummyController@store');
21
+	Route::patch('{id}', 'DummyController@update');
22
+	Route::delete('{id}', 'DummyController@destroy');
23
+	Route::patch('restore/{id}', 'DummyController@restore');
24 24
 });
Please login to merge, or discard this patch.
src/Modules/Roles/Database/Seeds/RolesTableSeeder.php 1 patch
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -8,80 +8,80 @@
 block discarded – undo
8 8
 
9 9
 class RolesTableSeeder extends Seeder
10 10
 {
11
-    /**
12
-     * Run the database seeds.
13
-     *
14
-     * @return void
15
-     */
16
-    public function run()
17
-    {        
18
-        /**
19
-         * Assign default users to admin roles.
20
-         */
21
-        $adminRoleId = Role::where('name', 'Admin')->select('id')->first()->id;;
22
-        $adminUserId = AclUser::where('email', '[email protected]')->select('id')->first()->id;
23
-        \DB::table('role_user')->updateOrInsert([
24
-            'user_id' => $adminUserId,
25
-            'role_id' => $adminRoleId,
26
-        ],[]);
11
+	/**
12
+	 * Run the database seeds.
13
+	 *
14
+	 * @return void
15
+	 */
16
+	public function run()
17
+	{        
18
+		/**
19
+		 * Assign default users to admin roles.
20
+		 */
21
+		$adminRoleId = Role::where('name', 'Admin')->select('id')->first()->id;;
22
+		$adminUserId = AclUser::where('email', '[email protected]')->select('id')->first()->id;
23
+		\DB::table('role_user')->updateOrInsert([
24
+			'user_id' => $adminUserId,
25
+			'role_id' => $adminRoleId,
26
+		],[]);
27 27
 
28
-        /**
29
-         * Insert the permissions related to roles table.
30
-         */
31
-        \DB::table('permissions')->insert(
32
-            [
33
-                /**
34
-                 * Roles model permissions.
35
-                 */
36
-                [
37
-                'name'       => 'index',
38
-                'model'      => 'role',
39
-                'created_at' => \DB::raw('NOW()'),
40
-                'updated_at' => \DB::raw('NOW()')
41
-                ],
42
-                [
43
-                'name'       => 'show',
44
-                'model'      => 'role',
45
-                'created_at' => \DB::raw('NOW()'),
46
-                'updated_at' => \DB::raw('NOW()')
47
-                ],
48
-                [
49
-                'name'       => 'store',
50
-                'model'      => 'role',
51
-                'created_at' => \DB::raw('NOW()'),
52
-                'updated_at' => \DB::raw('NOW()')
53
-                ],
54
-                [
55
-                'name'       => 'update',
56
-                'model'      => 'role',
57
-                'created_at' => \DB::raw('NOW()'),
58
-                'updated_at' => \DB::raw('NOW()')
59
-                ],
60
-                [
61
-                'name'       => 'destroy',
62
-                'model'      => 'role',
63
-                'created_at' => \DB::raw('NOW()'),
64
-                'updated_at' => \DB::raw('NOW()')
65
-                ],
66
-                [
67
-                'name'       => 'deleted',
68
-                'model'      => 'role',
69
-                'created_at' => \DB::raw('NOW()'),
70
-                'updated_at' => \DB::raw('NOW()')
71
-                ],
72
-                [
73
-                'name'       => 'restore',
74
-                'model'      => 'role',
75
-                'created_at' => \DB::raw('NOW()'),
76
-                'updated_at' => \DB::raw('NOW()')
77
-                ],
78
-                [
79
-                'name'       => 'assignPermissions',
80
-                'model'      => 'role',
81
-                'created_at' => \DB::raw('NOW()'),
82
-                'updated_at' => \DB::raw('NOW()')
83
-                ],
84
-            ]
85
-        );
86
-    }
28
+		/**
29
+		 * Insert the permissions related to roles table.
30
+		 */
31
+		\DB::table('permissions')->insert(
32
+			[
33
+				/**
34
+				 * Roles model permissions.
35
+				 */
36
+				[
37
+				'name'       => 'index',
38
+				'model'      => 'role',
39
+				'created_at' => \DB::raw('NOW()'),
40
+				'updated_at' => \DB::raw('NOW()')
41
+				],
42
+				[
43
+				'name'       => 'show',
44
+				'model'      => 'role',
45
+				'created_at' => \DB::raw('NOW()'),
46
+				'updated_at' => \DB::raw('NOW()')
47
+				],
48
+				[
49
+				'name'       => 'store',
50
+				'model'      => 'role',
51
+				'created_at' => \DB::raw('NOW()'),
52
+				'updated_at' => \DB::raw('NOW()')
53
+				],
54
+				[
55
+				'name'       => 'update',
56
+				'model'      => 'role',
57
+				'created_at' => \DB::raw('NOW()'),
58
+				'updated_at' => \DB::raw('NOW()')
59
+				],
60
+				[
61
+				'name'       => 'destroy',
62
+				'model'      => 'role',
63
+				'created_at' => \DB::raw('NOW()'),
64
+				'updated_at' => \DB::raw('NOW()')
65
+				],
66
+				[
67
+				'name'       => 'deleted',
68
+				'model'      => 'role',
69
+				'created_at' => \DB::raw('NOW()'),
70
+				'updated_at' => \DB::raw('NOW()')
71
+				],
72
+				[
73
+				'name'       => 'restore',
74
+				'model'      => 'role',
75
+				'created_at' => \DB::raw('NOW()'),
76
+				'updated_at' => \DB::raw('NOW()')
77
+				],
78
+				[
79
+				'name'       => 'assignPermissions',
80
+				'model'      => 'role',
81
+				'created_at' => \DB::raw('NOW()'),
82
+				'updated_at' => \DB::raw('NOW()')
83
+				],
84
+			]
85
+		);
86
+	}
87 87
 }
Please login to merge, or discard this patch.
src/Modules/Roles/Http/Controllers/RoleController.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -10,40 +10,40 @@
 block discarded – undo
10 10
 
11 11
 class RoleController extends BaseApiController
12 12
 {
13
-    /**
14
-     * Path of the sotre form request.
15
-     *
16
-     * @var string
17
-     */
18
-    protected $storeFormRequest = 'App\Modules\Roles\Http\Requests\StoreRole';
13
+	/**
14
+	 * Path of the sotre form request.
15
+	 *
16
+	 * @var string
17
+	 */
18
+	protected $storeFormRequest = 'App\Modules\Roles\Http\Requests\StoreRole';
19 19
 
20
-    /**
21
-     * Path of the model resource
22
-     *
23
-     * @var string
24
-     */
25
-    protected $modelResource = 'App\Modules\Roles\Http\Resources\Role';
20
+	/**
21
+	 * Path of the model resource
22
+	 *
23
+	 * @var string
24
+	 */
25
+	protected $modelResource = 'App\Modules\Roles\Http\Resources\Role';
26 26
 
27
-    /**
28
-     * Init new object.
29
-     *
30
-     * @param   RoleService $service
31
-     * @return  void
32
-     */
33
-    public function __construct(RoleService $service)
34
-    {
35
-        parent::__construct($service);
36
-    }
27
+	/**
28
+	 * Init new object.
29
+	 *
30
+	 * @param   RoleService $service
31
+	 * @return  void
32
+	 */
33
+	public function __construct(RoleService $service)
34
+	{
35
+		parent::__construct($service);
36
+	}
37 37
 
38
-    /**
39
-     * Handle an assign permissions to role request.
40
-     *
41
-     * @param  AssignPermissions $request
42
-     * @param  integer           $id
43
-     * @return \Illuminate\Http\Response
44
-     */
45
-    public function assignPermissions(AssignPermissions $request, $id)
46
-    {
47
-        return new $this->modelResource($this->service->assignPermissions($id, $request->get('permission_ids')));
48
-    }
38
+	/**
39
+	 * Handle an assign permissions to role request.
40
+	 *
41
+	 * @param  AssignPermissions $request
42
+	 * @param  integer           $id
43
+	 * @return \Illuminate\Http\Response
44
+	 */
45
+	public function assignPermissions(AssignPermissions $request, $id)
46
+	{
47
+		return new $this->modelResource($this->service->assignPermissions($id, $request->get('permission_ids')));
48
+	}
49 49
 }
Please login to merge, or discard this patch.
src/Modules/Users/Http/Controllers/UserController.php 1 patch
Indentation   +207 added lines, -207 removed lines patch added patch discarded remove patch
@@ -20,211 +20,211 @@
 block discarded – undo
20 20
 
21 21
 class UserController extends BaseApiController
22 22
 {
23
-    /**
24
-     * Path of the sotre form request.
25
-     *
26
-     * @var string
27
-     */
28
-    protected $storeFormRequest = 'App\Modules\Users\Http\Requests\StoreUser';
29
-
30
-    /**
31
-     * Path of the model resource.
32
-     *
33
-     * @var string
34
-     */
35
-    protected $modelResource = 'App\Modules\Users\Http\Resources\AclUser';
36
-
37
-    /**
38
-     * List of all route actions that the base api controller
39
-     * will skip permissions check for them.
40
-     * @var array
41
-     */
42
-    protected $skipPermissionCheck = ['account', 'logout', 'changePassword', 'saveProfile'];
43
-
44
-    /**
45
-     * List of all route actions that the base api controller
46
-     * will skip login check for them.
47
-     * @var array
48
-     */
49
-    protected $skipLoginCheck = ['login', 'loginSocial', 'register', 'sendReset', 'resetPassword', 'refreshToken', 'confirmEmail', 'resendEmailConfirmation'];
50
-
51
-    /**
52
-     * Init new object.
53
-     *
54
-     * @param   UserService $service
55
-     * @return  void
56
-     */
57
-    public function __construct(UserService $service)
58
-    {
59
-        parent::__construct($service);
60
-    }
61
-
62
-    /**
63
-     * Return the logged in user account.
64
-     *
65
-     * @param Request $request
66
-     * @return \Illuminate\Http\Response
67
-     */
68
-    public function account(Request $request)
69
-    {
70
-        return new $this->modelResource($this->service->account($request->relations));
71
-    }
72
-
73
-    /**
74
-     * Block the user.
75
-     *
76
-     * @param  integer  $id Id of the user.
77
-     * @return \Illuminate\Http\Response
78
-     */
79
-    public function block($id)
80
-    {
81
-        return new $this->modelResource($this->service->block($id));
82
-    }
83
-
84
-    /**
85
-     * Unblock the user.
86
-     *
87
-     * @param  integer  $id Id of the user.
88
-     * @return \Illuminate\Http\Response
89
-     */
90
-    public function unblock($id)
91
-    {
92
-        return new $this->modelResource($this->service->unblock($id));
93
-    }
94
-
95
-    /**
96
-     * Logout the user.
97
-     *
98
-     * @return \Illuminate\Http\Response
99
-     */
100
-    public function logout()
101
-    {
102
-        return new GeneralResource($this->service->logout());
103
-    }
104
-
105
-    /**
106
-     * Handle the registration request.
107
-     *
108
-     * @param Register $request
109
-     * @return \Illuminate\Http\Response
110
-     */
111
-    public function register(Register $request)
112
-    {
113
-        return new $this->modelResource($this->service->register($request->get('name'), $request->get('email'), $request->get('password')));
114
-    }
115
-
116
-    /**
117
-     * Handle the login request to the application.
118
-     *
119
-     * @param Login $request
120
-     * @return \Illuminate\Http\Response
121
-     */
122
-    public function login(Login $request)
123
-    {
124
-        $result = $this->service->login($request->get('email'), $request->get('password'));
125
-
126
-        return (new $this->modelResource($result['user']))->additional(['meta' => $result['tokens']]);
127
-    }
128
-
129
-    /**
130
-     * Handle the social login request the application.
131
-     *
132
-     * @param LoginSocial $request
133
-     * @return \Illuminate\Http\Response
134
-     */
135
-    public function loginSocial(LoginSocial $request)
136
-    {
137
-        $result = $this->service->loginSocial($request->get('auth_code'), $request->get('access_token'), $request->get('type'));
138
-
139
-        return (new $this->modelResource($result['user']))->additional(['meta' => $result['tokens']]);
140
-    }
141
-
142
-    /**
143
-     * Assign the given roles to the given user.
144
-     *
145
-     * @param AssignRoles $request
146
-     * @param integer     $id
147
-     * @return \Illuminate\Http\Response
148
-     */
149
-    public function assignRoles(AssignRoles $request, $id)
150
-    {
151
-        return new $this->modelResource($this->service->assignRoles($id, $request->get('role_ids')));
152
-    }
153
-
154
-    /**
155
-     * Send a reset link to the given user.
156
-     *
157
-     * @param SendReset $request
158
-     * @return \Illuminate\Http\Response
159
-     */
160
-    public function sendReset(SendReset $request)
161
-    {
162
-        return new GeneralResource($this->service->sendReset($request->get('email')));
163
-    }
164
-
165
-    /**
166
-     * Reset the given user's password.
167
-     *
168
-     * @param ResetPassword $request
169
-     * @return \Illuminate\Http\Response
170
-     */
171
-    public function resetPassword(ResetPassword $request)
172
-    {
173
-        return new GeneralResource($this->service->resetPassword($request->get('email'), $request->get('password'), $request->get('password_confirmation'), $request->get('token')));
174
-    }
175
-
176
-    /**
177
-     * Change the logged in user password.
178
-     *
179
-     * @param ChangePassword $request
180
-     * @return \Illuminate\Http\Response
181
-     */
182
-    public function changePassword(ChangePassword $request)
183
-    {
184
-        return new GeneralResource($this->service->changePassword($request->get('password'), $request->get('old_password')));
185
-    }
186
-
187
-    /**
188
-     * Confirm email using the confirmation code.
189
-     *
190
-     * @param ConfirmEmail $request
191
-     * @return \Illuminate\Http\Response
192
-     */
193
-    public function confirmEmail(ConfirmEmail $request)
194
-    {
195
-        return new GeneralResource($this->service->confirmEmail($request->only('confirmation_code')));
196
-    }
197
-
198
-    /**
199
-     * Resend the email confirmation mail.
200
-     *
201
-     * @param ResendEmailConfirmation $request
202
-     * @return \Illuminate\Http\Response
203
-     */
204
-    public function resendEmailConfirmation(ResendEmailConfirmation $request)
205
-    {
206
-        return new GeneralResource($this->service->sendConfirmationEmail($request->get('email')));
207
-    }
208
-
209
-    /**
210
-     * Refresh the expired login token.
211
-     *
212
-     * @param RefreshToken $request
213
-     * @return \Illuminate\Http\Response
214
-     */
215
-    public function refreshToken(RefreshToken $request)
216
-    {
217
-        return new GeneralResource($this->service->refreshToken($request->get('refresh_token')));
218
-    }
219
-
220
-    /**
221
-     * Save the given data to the logged in user.
222
-     *
223
-     * @param SaveProfile $request
224
-     * @return \Illuminate\Http\Response
225
-     */
226
-    public function saveProfile(SaveProfile $request)
227
-    {
228
-        return new $this->modelResource($this->service->saveProfile($request->get('name'), $request->get('email'), $request->get('profile_picture')));
229
-    }
23
+	/**
24
+	 * Path of the sotre form request.
25
+	 *
26
+	 * @var string
27
+	 */
28
+	protected $storeFormRequest = 'App\Modules\Users\Http\Requests\StoreUser';
29
+
30
+	/**
31
+	 * Path of the model resource.
32
+	 *
33
+	 * @var string
34
+	 */
35
+	protected $modelResource = 'App\Modules\Users\Http\Resources\AclUser';
36
+
37
+	/**
38
+	 * List of all route actions that the base api controller
39
+	 * will skip permissions check for them.
40
+	 * @var array
41
+	 */
42
+	protected $skipPermissionCheck = ['account', 'logout', 'changePassword', 'saveProfile'];
43
+
44
+	/**
45
+	 * List of all route actions that the base api controller
46
+	 * will skip login check for them.
47
+	 * @var array
48
+	 */
49
+	protected $skipLoginCheck = ['login', 'loginSocial', 'register', 'sendReset', 'resetPassword', 'refreshToken', 'confirmEmail', 'resendEmailConfirmation'];
50
+
51
+	/**
52
+	 * Init new object.
53
+	 *
54
+	 * @param   UserService $service
55
+	 * @return  void
56
+	 */
57
+	public function __construct(UserService $service)
58
+	{
59
+		parent::__construct($service);
60
+	}
61
+
62
+	/**
63
+	 * Return the logged in user account.
64
+	 *
65
+	 * @param Request $request
66
+	 * @return \Illuminate\Http\Response
67
+	 */
68
+	public function account(Request $request)
69
+	{
70
+		return new $this->modelResource($this->service->account($request->relations));
71
+	}
72
+
73
+	/**
74
+	 * Block the user.
75
+	 *
76
+	 * @param  integer  $id Id of the user.
77
+	 * @return \Illuminate\Http\Response
78
+	 */
79
+	public function block($id)
80
+	{
81
+		return new $this->modelResource($this->service->block($id));
82
+	}
83
+
84
+	/**
85
+	 * Unblock the user.
86
+	 *
87
+	 * @param  integer  $id Id of the user.
88
+	 * @return \Illuminate\Http\Response
89
+	 */
90
+	public function unblock($id)
91
+	{
92
+		return new $this->modelResource($this->service->unblock($id));
93
+	}
94
+
95
+	/**
96
+	 * Logout the user.
97
+	 *
98
+	 * @return \Illuminate\Http\Response
99
+	 */
100
+	public function logout()
101
+	{
102
+		return new GeneralResource($this->service->logout());
103
+	}
104
+
105
+	/**
106
+	 * Handle the registration request.
107
+	 *
108
+	 * @param Register $request
109
+	 * @return \Illuminate\Http\Response
110
+	 */
111
+	public function register(Register $request)
112
+	{
113
+		return new $this->modelResource($this->service->register($request->get('name'), $request->get('email'), $request->get('password')));
114
+	}
115
+
116
+	/**
117
+	 * Handle the login request to the application.
118
+	 *
119
+	 * @param Login $request
120
+	 * @return \Illuminate\Http\Response
121
+	 */
122
+	public function login(Login $request)
123
+	{
124
+		$result = $this->service->login($request->get('email'), $request->get('password'));
125
+
126
+		return (new $this->modelResource($result['user']))->additional(['meta' => $result['tokens']]);
127
+	}
128
+
129
+	/**
130
+	 * Handle the social login request the application.
131
+	 *
132
+	 * @param LoginSocial $request
133
+	 * @return \Illuminate\Http\Response
134
+	 */
135
+	public function loginSocial(LoginSocial $request)
136
+	{
137
+		$result = $this->service->loginSocial($request->get('auth_code'), $request->get('access_token'), $request->get('type'));
138
+
139
+		return (new $this->modelResource($result['user']))->additional(['meta' => $result['tokens']]);
140
+	}
141
+
142
+	/**
143
+	 * Assign the given roles to the given user.
144
+	 *
145
+	 * @param AssignRoles $request
146
+	 * @param integer     $id
147
+	 * @return \Illuminate\Http\Response
148
+	 */
149
+	public function assignRoles(AssignRoles $request, $id)
150
+	{
151
+		return new $this->modelResource($this->service->assignRoles($id, $request->get('role_ids')));
152
+	}
153
+
154
+	/**
155
+	 * Send a reset link to the given user.
156
+	 *
157
+	 * @param SendReset $request
158
+	 * @return \Illuminate\Http\Response
159
+	 */
160
+	public function sendReset(SendReset $request)
161
+	{
162
+		return new GeneralResource($this->service->sendReset($request->get('email')));
163
+	}
164
+
165
+	/**
166
+	 * Reset the given user's password.
167
+	 *
168
+	 * @param ResetPassword $request
169
+	 * @return \Illuminate\Http\Response
170
+	 */
171
+	public function resetPassword(ResetPassword $request)
172
+	{
173
+		return new GeneralResource($this->service->resetPassword($request->get('email'), $request->get('password'), $request->get('password_confirmation'), $request->get('token')));
174
+	}
175
+
176
+	/**
177
+	 * Change the logged in user password.
178
+	 *
179
+	 * @param ChangePassword $request
180
+	 * @return \Illuminate\Http\Response
181
+	 */
182
+	public function changePassword(ChangePassword $request)
183
+	{
184
+		return new GeneralResource($this->service->changePassword($request->get('password'), $request->get('old_password')));
185
+	}
186
+
187
+	/**
188
+	 * Confirm email using the confirmation code.
189
+	 *
190
+	 * @param ConfirmEmail $request
191
+	 * @return \Illuminate\Http\Response
192
+	 */
193
+	public function confirmEmail(ConfirmEmail $request)
194
+	{
195
+		return new GeneralResource($this->service->confirmEmail($request->only('confirmation_code')));
196
+	}
197
+
198
+	/**
199
+	 * Resend the email confirmation mail.
200
+	 *
201
+	 * @param ResendEmailConfirmation $request
202
+	 * @return \Illuminate\Http\Response
203
+	 */
204
+	public function resendEmailConfirmation(ResendEmailConfirmation $request)
205
+	{
206
+		return new GeneralResource($this->service->sendConfirmationEmail($request->get('email')));
207
+	}
208
+
209
+	/**
210
+	 * Refresh the expired login token.
211
+	 *
212
+	 * @param RefreshToken $request
213
+	 * @return \Illuminate\Http\Response
214
+	 */
215
+	public function refreshToken(RefreshToken $request)
216
+	{
217
+		return new GeneralResource($this->service->refreshToken($request->get('refresh_token')));
218
+	}
219
+
220
+	/**
221
+	 * Save the given data to the logged in user.
222
+	 *
223
+	 * @param SaveProfile $request
224
+	 * @return \Illuminate\Http\Response
225
+	 */
226
+	public function saveProfile(SaveProfile $request)
227
+	{
228
+		return new $this->modelResource($this->service->saveProfile($request->get('name'), $request->get('email'), $request->get('profile_picture')));
229
+	}
230 230
 }
Please login to merge, or discard this patch.