Completed
Push — master ( 8023d3...8b2ccd )
by Sherif
10:04
created
src/Modules/Core/BaseClasses/BaseService.php 1 patch
Indentation   +169 added lines, -169 removed lines patch added patch discarded remove patch
@@ -7,188 +7,188 @@
 block discarded – undo
7 7
 
8 8
 abstract class BaseService implements BaseServiceInterface
9 9
 {
10
-    /**
11
-     * @var object
12
-     */
13
-    protected $repo;
10
+	/**
11
+	 * @var object
12
+	 */
13
+	protected $repo;
14 14
 
15
-    /**
16
-     * Init new object.
17
-     *
18
-     * @param   mixed  $repo
19
-     * @return  void
20
-     */
21
-    public function __construct($repo)
22
-    {
23
-        $this->repo = new CachingDecorator($repo, \App::make('Illuminate\Contracts\Cache\Repository'));
24
-    }
15
+	/**
16
+	 * Init new object.
17
+	 *
18
+	 * @param   mixed  $repo
19
+	 * @return  void
20
+	 */
21
+	public function __construct($repo)
22
+	{
23
+		$this->repo = new CachingDecorator($repo, \App::make('Illuminate\Contracts\Cache\Repository'));
24
+	}
25 25
 
26
-    /**
27
-     * Fetch records with relations based on the given params.
28
-     *
29
-     * @param   string  $relations
30
-     * @param   array   $conditions
31
-     * @param   integer $perPage
32
-     * @param   string  $sortBy
33
-     * @param   boolean $desc
34
-     * @param   boolean $trashed
35
-     * @return collection
36
-     */
37
-    public function list($relations = [], $conditions = false, $perPage = 15, $sortBy = 'created_at', $desc = true, $trashed = false)
38
-    {
39
-        unset($conditions['perPage']);
40
-        unset($conditions['sortBy']);
41
-        unset($conditions['sort']);
42
-        unset($conditions['page']);
26
+	/**
27
+	 * Fetch records with relations based on the given params.
28
+	 *
29
+	 * @param   string  $relations
30
+	 * @param   array   $conditions
31
+	 * @param   integer $perPage
32
+	 * @param   string  $sortBy
33
+	 * @param   boolean $desc
34
+	 * @param   boolean $trashed
35
+	 * @return collection
36
+	 */
37
+	public function list($relations = [], $conditions = false, $perPage = 15, $sortBy = 'created_at', $desc = true, $trashed = false)
38
+	{
39
+		unset($conditions['perPage']);
40
+		unset($conditions['sortBy']);
41
+		unset($conditions['sort']);
42
+		unset($conditions['page']);
43 43
 
44
-        if ($trashed) {
45
-            return $this->deleted(['and' => $conditions], $perPage ?? 15, $sortBy ?? 'created_at', $desc ?? true);
46
-        }
44
+		if ($trashed) {
45
+			return $this->deleted(['and' => $conditions], $perPage ?? 15, $sortBy ?? 'created_at', $desc ?? true);
46
+		}
47 47
         
48
-        if (count($conditions)) {
49
-            return $this->paginateBy(['and' => $conditions], $perPage ?? 15, $relations, $sortBy ?? 'created_at', $desc ?? true);
50
-        }
48
+		if (count($conditions)) {
49
+			return $this->paginateBy(['and' => $conditions], $perPage ?? 15, $relations, $sortBy ?? 'created_at', $desc ?? true);
50
+		}
51 51
 
52
-        return $this->paginate($perPage ?? 15, $relations, $sortBy ?? 'created_at', $desc ?? true);
53
-    }
52
+		return $this->paginate($perPage ?? 15, $relations, $sortBy ?? 'created_at', $desc ?? true);
53
+	}
54 54
 
55
-    /**
56
-     * Fetch all records with relations from the storage.
57
-     *
58
-     * @param  array   $relations
59
-     * @param  string  $sortBy
60
-     * @param  boolean $desc
61
-     * @param  array   $columns
62
-     * @return collection
63
-     */
64
-    public function all($relations = [], $sortBy = 'created_at', $desc = 1, $columns = ['*'])
65
-    {
66
-        return $this->repo->all($relations, $sortBy, $desc, $columns);
67
-    }
55
+	/**
56
+	 * Fetch all records with relations from the storage.
57
+	 *
58
+	 * @param  array   $relations
59
+	 * @param  string  $sortBy
60
+	 * @param  boolean $desc
61
+	 * @param  array   $columns
62
+	 * @return collection
63
+	 */
64
+	public function all($relations = [], $sortBy = 'created_at', $desc = 1, $columns = ['*'])
65
+	{
66
+		return $this->repo->all($relations, $sortBy, $desc, $columns);
67
+	}
68 68
     
69
-    /**
70
-     * Fetch all records with relations from storage in pages.
71
-     *
72
-     * @param  integer $perPage
73
-     * @param  array   $relations
74
-     * @param  string  $sortBy
75
-     * @param  boolean $desc
76
-     * @param  array   $columns
77
-     * @return collection
78
-     */
79
-    public function paginate($perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 1, $columns = ['*'])
80
-    {
81
-        return $this->repo->paginate($perPage, $relations, $sortBy, $desc, $columns);
82
-    }
69
+	/**
70
+	 * Fetch all records with relations from storage in pages.
71
+	 *
72
+	 * @param  integer $perPage
73
+	 * @param  array   $relations
74
+	 * @param  string  $sortBy
75
+	 * @param  boolean $desc
76
+	 * @param  array   $columns
77
+	 * @return collection
78
+	 */
79
+	public function paginate($perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 1, $columns = ['*'])
80
+	{
81
+		return $this->repo->paginate($perPage, $relations, $sortBy, $desc, $columns);
82
+	}
83 83
 
84
-    /**
85
-     * Fetch all records with relations based on
86
-     * the given condition from storage in pages.
87
-     *
88
-     * @param  array   $conditions array of conditions
89
-     * @param  integer $perPage
90
-     * @param  array   $relations
91
-     * @param  string  $sortBy
92
-     * @param  boolean $desc
93
-     * @param  array   $columns
94
-     * @return collection
95
-     */
96
-    public function paginateBy($conditions, $perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 1, $columns = ['*'])
97
-    {
98
-        return $this->repo->paginateBy($conditions, $perPage, $relations, $sortBy, $desc, $columns);
99
-    }
84
+	/**
85
+	 * Fetch all records with relations based on
86
+	 * the given condition from storage in pages.
87
+	 *
88
+	 * @param  array   $conditions array of conditions
89
+	 * @param  integer $perPage
90
+	 * @param  array   $relations
91
+	 * @param  string  $sortBy
92
+	 * @param  boolean $desc
93
+	 * @param  array   $columns
94
+	 * @return collection
95
+	 */
96
+	public function paginateBy($conditions, $perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 1, $columns = ['*'])
97
+	{
98
+		return $this->repo->paginateBy($conditions, $perPage, $relations, $sortBy, $desc, $columns);
99
+	}
100 100
     
101
-    /**
102
-     * Save the given model to the storage.
103
-     *
104
-     * @param  array $data
105
-     * @return mixed
106
-     */
107
-    public function save(array $data)
108
-    {
109
-        return $this->repo->save($data);
110
-    }
101
+	/**
102
+	 * Save the given model to the storage.
103
+	 *
104
+	 * @param  array $data
105
+	 * @return mixed
106
+	 */
107
+	public function save(array $data)
108
+	{
109
+		return $this->repo->save($data);
110
+	}
111 111
 
112
-    /**
113
-     * Delete record from the storage based on the given
114
-     * condition.
115
-     *
116
-     * @param  var $value condition value
117
-     * @param  string $attribute condition column name
118
-     * @return void
119
-     */
120
-    public function delete($value, $attribute = 'id')
121
-    {
122
-        return $this->repo->save($value, $attribute);
123
-    }
112
+	/**
113
+	 * Delete record from the storage based on the given
114
+	 * condition.
115
+	 *
116
+	 * @param  var $value condition value
117
+	 * @param  string $attribute condition column name
118
+	 * @return void
119
+	 */
120
+	public function delete($value, $attribute = 'id')
121
+	{
122
+		return $this->repo->save($value, $attribute);
123
+	}
124 124
     
125
-    /**
126
-     * Fetch records from the storage based on the given
127
-     * id.
128
-     *
129
-     * @param  integer $id
130
-     * @param  string[]   $relations
131
-     * @param  array   $columns
132
-     * @return object
133
-     */
134
-    public function find($id, $relations = [], $columns = ['*'])
135
-    {
136
-        return $this->repo->find($id, $relations, $columns);
137
-    }
125
+	/**
126
+	 * Fetch records from the storage based on the given
127
+	 * id.
128
+	 *
129
+	 * @param  integer $id
130
+	 * @param  string[]   $relations
131
+	 * @param  array   $columns
132
+	 * @return object
133
+	 */
134
+	public function find($id, $relations = [], $columns = ['*'])
135
+	{
136
+		return $this->repo->find($id, $relations, $columns);
137
+	}
138 138
     
139
-    /**
140
-     * Fetch records from the storage based on the given
141
-     * condition.
142
-     *
143
-     * @param  array   $conditions array of conditions
144
-     * @param  array   $relations
145
-     * @param  string  $sortBy
146
-     * @param  boolean $desc
147
-     * @param  array   $columns
148
-     * @return collection
149
-     */
150
-    public function findBy($conditions, $relations = [], $sortBy = 'created_at', $desc = 1, $columns = ['*'])
151
-    {
152
-        return $this->repo->findBy($conditions, $relations, $sortBy, $desc, $columns);
153
-    }
139
+	/**
140
+	 * Fetch records from the storage based on the given
141
+	 * condition.
142
+	 *
143
+	 * @param  array   $conditions array of conditions
144
+	 * @param  array   $relations
145
+	 * @param  string  $sortBy
146
+	 * @param  boolean $desc
147
+	 * @param  array   $columns
148
+	 * @return collection
149
+	 */
150
+	public function findBy($conditions, $relations = [], $sortBy = 'created_at', $desc = 1, $columns = ['*'])
151
+	{
152
+		return $this->repo->findBy($conditions, $relations, $sortBy, $desc, $columns);
153
+	}
154 154
 
155
-    /**
156
-     * Fetch the first record from the storage based on the given
157
-     * condition.
158
-     *
159
-     * @param  array   $conditions array of conditions
160
-     * @param  array   $relations
161
-     * @param  array   $columns
162
-     * @return object
163
-     */
164
-    public function first($conditions, $relations = [], $columns = ['*'])
165
-    {
166
-        return $this->repo->first($conditions, $relations, $columns);
167
-    }
155
+	/**
156
+	 * Fetch the first record from the storage based on the given
157
+	 * condition.
158
+	 *
159
+	 * @param  array   $conditions array of conditions
160
+	 * @param  array   $relations
161
+	 * @param  array   $columns
162
+	 * @return object
163
+	 */
164
+	public function first($conditions, $relations = [], $columns = ['*'])
165
+	{
166
+		return $this->repo->first($conditions, $relations, $columns);
167
+	}
168 168
 
169
-    /**
170
-     * Return the deleted models in pages based on the given conditions.
171
-     *
172
-     * @param  array   $conditions array of conditions
173
-     * @param  integer $perPage
174
-     * @param  string  $sortBy
175
-     * @param  boolean $desc
176
-     * @param  array   $columns
177
-     * @return collection
178
-     */
179
-    public function deleted($conditions, $perPage = 15, $sortBy = 'created_at', $desc = 1, $columns = ['*'])
180
-    {
181
-        return $this->repo->deleted($conditions, $perPage, $sortBy, $desc, $columns);
182
-    }
169
+	/**
170
+	 * Return the deleted models in pages based on the given conditions.
171
+	 *
172
+	 * @param  array   $conditions array of conditions
173
+	 * @param  integer $perPage
174
+	 * @param  string  $sortBy
175
+	 * @param  boolean $desc
176
+	 * @param  array   $columns
177
+	 * @return collection
178
+	 */
179
+	public function deleted($conditions, $perPage = 15, $sortBy = 'created_at', $desc = 1, $columns = ['*'])
180
+	{
181
+		return $this->repo->deleted($conditions, $perPage, $sortBy, $desc, $columns);
182
+	}
183 183
 
184
-    /**
185
-     * Restore the deleted model.
186
-     *
187
-     * @param  integer $id
188
-     * @return void
189
-     */
190
-    public function restore($id)
191
-    {
192
-        return $this->repo->restore($id);
193
-    }
184
+	/**
185
+	 * Restore the deleted model.
186
+	 *
187
+	 * @param  integer $id
188
+	 * @return void
189
+	 */
190
+	public function restore($id)
191
+	{
192
+		return $this->repo->restore($id);
193
+	}
194 194
 }
Please login to merge, or discard this patch.
src/Modules/Core/BaseClasses/BaseApiController.php 1 patch
Indentation   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -8,109 +8,109 @@
 block discarded – undo
8 8
 
9 9
 class BaseApiController extends Controller
10 10
 {
11
-    /**
12
-     * Array of eager loaded relations.
13
-     *
14
-     * @var array
15
-     */
16
-    protected $relations;
11
+	/**
12
+	 * Array of eager loaded relations.
13
+	 *
14
+	 * @var array
15
+	 */
16
+	protected $relations;
17 17
 
18
-    /**
19
-     * @var object
20
-     */
21
-    protected $service;
18
+	/**
19
+	 * @var object
20
+	 */
21
+	protected $service;
22 22
 
23
-    /**
24
-     * Path of the model resource.
25
-     *
26
-     * @var string
27
-     */
28
-    protected $modelResource;
23
+	/**
24
+	 * Path of the model resource.
25
+	 *
26
+	 * @var string
27
+	 */
28
+	protected $modelResource;
29 29
 
30
-    /**
31
-     * Path of the sotre form request.
32
-     *
33
-     * @var string
34
-     */
35
-    protected $storeFormRequest;
30
+	/**
31
+	 * Path of the sotre form request.
32
+	 *
33
+	 * @var string
34
+	 */
35
+	protected $storeFormRequest;
36 36
 
37
-    /**
38
-     * Init new object.
39
-     *
40
-     * @param   mixed      $service
41
-     * @return  void
42
-     */
43
-    public function __construct($service)
44
-    {
45
-        $this->service = $service;
46
-    }
37
+	/**
38
+	 * Init new object.
39
+	 *
40
+	 * @param   mixed      $service
41
+	 * @return  void
42
+	 */
43
+	public function __construct($service)
44
+	{
45
+		$this->service = $service;
46
+	}
47 47
 
48
-    /**
49
-     * Fetch all records with relations from storage.
50
-     *
51
-     * @param Request $request
52
-     * @return \Illuminate\Http\Response
53
-     */
54
-    public function index(Request $request)
55
-    {
56
-        return $this->modelResource::collection($this->service->list($request->relations, $request->query(), $request->query('perPage'), $request->query('sortBy'), $request->query('desc'), $request->query('trashed')));
57
-    }
48
+	/**
49
+	 * Fetch all records with relations from storage.
50
+	 *
51
+	 * @param Request $request
52
+	 * @return \Illuminate\Http\Response
53
+	 */
54
+	public function index(Request $request)
55
+	{
56
+		return $this->modelResource::collection($this->service->list($request->relations, $request->query(), $request->query('perPage'), $request->query('sortBy'), $request->query('desc'), $request->query('trashed')));
57
+	}
58 58
 
59
-    /**
60
-     * Fetch the single object with relations from storage.
61
-     *
62
-     * @param  Request $request
63
-     * @param  integer $id Id of the requested model.
64
-     * @return \Illuminate\Http\Response
65
-     */
66
-    public function show(Request $request, $id)
67
-    {
68
-        return new $this->modelResource($this->service->find($id, $request->relations));
69
-    }
59
+	/**
60
+	 * Fetch the single object with relations from storage.
61
+	 *
62
+	 * @param  Request $request
63
+	 * @param  integer $id Id of the requested model.
64
+	 * @return \Illuminate\Http\Response
65
+	 */
66
+	public function show(Request $request, $id)
67
+	{
68
+		return new $this->modelResource($this->service->find($id, $request->relations));
69
+	}
70 70
 
71
-    /**
72
-     * Insert the given model to storage.
73
-     *
74
-     * @return \Illuminate\Http\Response
75
-     */
76
-    public function store()
77
-    {
78
-        $data = \App::make($this->storeFormRequest)->validated();
79
-        return new $this->modelResource($this->service->save($data));
80
-    }
71
+	/**
72
+	 * Insert the given model to storage.
73
+	 *
74
+	 * @return \Illuminate\Http\Response
75
+	 */
76
+	public function store()
77
+	{
78
+		$data = \App::make($this->storeFormRequest)->validated();
79
+		return new $this->modelResource($this->service->save($data));
80
+	}
81 81
 
82
-    /**
83
-     * Update the given model to storage.
84
-     *
85
-     * @param integer   $id
86
-     * @return \Illuminate\Http\Response
87
-     */
88
-    public function update($id)
89
-    {
90
-        $data = \App::make($this->storeFormRequest)->validated();
91
-        $data['id'] = $id;
92
-        return new $this->modelResource($this->service->save($data));
93
-    }
82
+	/**
83
+	 * Update the given model to storage.
84
+	 *
85
+	 * @param integer   $id
86
+	 * @return \Illuminate\Http\Response
87
+	 */
88
+	public function update($id)
89
+	{
90
+		$data = \App::make($this->storeFormRequest)->validated();
91
+		$data['id'] = $id;
92
+		return new $this->modelResource($this->service->save($data));
93
+	}
94 94
 
95
-    /**
96
-     * Delete by the given id from storage.
97
-     *
98
-     * @param  integer $id Id of the deleted model.
99
-     * @return \Illuminate\Http\Response
100
-     */
101
-    public function destroy($id)
102
-    {
103
-        return new GeneralResource($this->service->delete($id));
104
-    }
95
+	/**
96
+	 * Delete by the given id from storage.
97
+	 *
98
+	 * @param  integer $id Id of the deleted model.
99
+	 * @return \Illuminate\Http\Response
100
+	 */
101
+	public function destroy($id)
102
+	{
103
+		return new GeneralResource($this->service->delete($id));
104
+	}
105 105
 
106
-    /**
107
-     * Restore the deleted model.
108
-     *
109
-     * @param  integer $id Id of the restored model.
110
-     * @return \Illuminate\Http\Response
111
-     */
112
-    public function restore($id)
113
-    {
114
-        return new GeneralResource($this->service->restore($id));
115
-    }
106
+	/**
107
+	 * Restore the deleted model.
108
+	 *
109
+	 * @param  integer $id Id of the restored model.
110
+	 * @return \Illuminate\Http\Response
111
+	 */
112
+	public function restore($id)
113
+	{
114
+		return new GeneralResource($this->service->restore($id));
115
+	}
116 116
 }
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/Roles/Http/Requests/AssignPermissions.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 AssignPermissions 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
-            'permission_ids' => 'required|exists:permissions,id'
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
+			'permission_ids' => 'required|exists:permissions,id'
28
+		];
29
+	}
30 30
 }
Please login to merge, or discard this patch.
src/Modules/Roles/Http/Requests/StoreRole.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 StoreRole 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
-            'name' => 'required|string|max:100|unique:roles,name,'.$this->get('id')
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
+			'name' => 'required|string|max:100|unique:roles,name,'.$this->get('id')
28
+		];
29
+	}
30 30
 }
Please login to merge, or discard this patch.
src/Modules/Roles/Routes/api.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@
 block discarded – undo
15 15
 
16 16
 Route::group(['prefix' => 'roles'], function () {
17 17
 
18
-    Route::get('/', 'RoleController@index');
19
-    Route::get('{id}', 'RoleController@show');
20
-    Route::post('/', 'RoleController@store');
21
-    Route::patch('{id}', 'RoleController@update');
22
-    Route::delete('{id}', 'RoleController@destroy');
23
-    Route::patch('{id}/restore', 'RoleController@restore');
24
-    Route::patch('{id}/assign/permissions', 'RoleController@assignPermissions');
18
+	Route::get('/', 'RoleController@index');
19
+	Route::get('{id}', 'RoleController@show');
20
+	Route::post('/', 'RoleController@store');
21
+	Route::patch('{id}', 'RoleController@update');
22
+	Route::delete('{id}', 'RoleController@destroy');
23
+	Route::patch('{id}/restore', 'RoleController@restore');
24
+	Route::patch('{id}/assign/permissions', 'RoleController@assignPermissions');
25 25
 });
Please login to merge, or discard this patch.
src/Modules/Users/Database/Seeds/UsersTableSeeder.php 1 patch
Indentation   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -8,105 +8,105 @@
 block discarded – undo
8 8
 
9 9
 class UsersTableSeeder extends Seeder
10 10
 {
11
-    /**
12
-     * Run the database seeds.
13
-     *
14
-     * @return void
15
-     */
16
-    public function run()
17
-    {
18
-        /**
19
-         * Create Default roles.
20
-         */
21
-        $role = Role::updateOrInsert([
22
-            'name' => 'Admin',
23
-        ],[
24
-            'created_at' => \DB::raw('NOW()'),
25
-            'updated_at' => \DB::raw('NOW()')
26
-        ]);
11
+	/**
12
+	 * Run the database seeds.
13
+	 *
14
+	 * @return void
15
+	 */
16
+	public function run()
17
+	{
18
+		/**
19
+		 * Create Default roles.
20
+		 */
21
+		$role = Role::updateOrInsert([
22
+			'name' => 'Admin',
23
+		],[
24
+			'created_at' => \DB::raw('NOW()'),
25
+			'updated_at' => \DB::raw('NOW()')
26
+		]);
27 27
 
28
-        /**
29
-         * Create Default user.
30
-         */
31
-        AclUser::updateOrInsert([
32
-            'email' => '[email protected]',
33
-        ],[
34
-            'name'       => 'Admin',
35
-            'password'   => \Hash::make('123456'),
36
-            'confirmed'  => 1,
37
-            'created_at' => \DB::raw('NOW()'),
38
-            'updated_at' => \DB::raw('NOW()')
39
-        ]);
28
+		/**
29
+		 * Create Default user.
30
+		 */
31
+		AclUser::updateOrInsert([
32
+			'email' => '[email protected]',
33
+		],[
34
+			'name'       => 'Admin',
35
+			'password'   => \Hash::make('123456'),
36
+			'confirmed'  => 1,
37
+			'created_at' => \DB::raw('NOW()'),
38
+			'updated_at' => \DB::raw('NOW()')
39
+		]);
40 40
 
41
-        /**
42
-         * Insert the permissions related to users table.
43
-         */
44
-        \DB::table('permissions')->insert(
45
-            [
46
-                /**
47
-                 * Users model permissions.
48
-                 */
49
-                [
50
-                'name'       => 'index',
51
-                'model'      => 'user',
52
-                'created_at' => \DB::raw('NOW()'),
53
-                'updated_at' => \DB::raw('NOW()')
54
-                ],
55
-                [
56
-                'name'       => 'show',
57
-                'model'      => 'user',
58
-                'created_at' => \DB::raw('NOW()'),
59
-                'updated_at' => \DB::raw('NOW()')
60
-                ],
61
-                [
62
-                'name'       => 'store',
63
-                'model'      => 'user',
64
-                'created_at' => \DB::raw('NOW()'),
65
-                'updated_at' => \DB::raw('NOW()')
66
-                ],
67
-                [
68
-                'name'       => 'update',
69
-                'model'      => 'user',
70
-                'created_at' => \DB::raw('NOW()'),
71
-                'updated_at' => \DB::raw('NOW()')
72
-                ],
73
-                [
74
-                'name'       => 'destroy',
75
-                'model'      => 'user',
76
-                'created_at' => \DB::raw('NOW()'),
77
-                'updated_at' => \DB::raw('NOW()')
78
-                ],
79
-                [
80
-                'name'       => 'deleted',
81
-                'model'      => 'user',
82
-                'created_at' => \DB::raw('NOW()'),
83
-                'updated_at' => \DB::raw('NOW()')
84
-                ],
85
-                [
86
-                'name'       => 'restore',
87
-                'model'      => 'user',
88
-                'created_at' => \DB::raw('NOW()'),
89
-                'updated_at' => \DB::raw('NOW()')
90
-                ],
91
-                [
92
-                'name'       => 'assignRoles',
93
-                'model'      => 'user',
94
-                'created_at' => \DB::raw('NOW()'),
95
-                'updated_at' => \DB::raw('NOW()')
96
-                ],
97
-                [
98
-                'name'       => 'block',
99
-                'model'      => 'user',
100
-                'created_at' => \DB::raw('NOW()'),
101
-                'updated_at' => \DB::raw('NOW()')
102
-                ],
103
-                [
104
-                'name'       => 'unblock',
105
-                'model'      => 'user',
106
-                'created_at' => \DB::raw('NOW()'),
107
-                'updated_at' => \DB::raw('NOW()')
108
-                ]
109
-            ]
110
-        );
111
-    }
41
+		/**
42
+		 * Insert the permissions related to users table.
43
+		 */
44
+		\DB::table('permissions')->insert(
45
+			[
46
+				/**
47
+				 * Users model permissions.
48
+				 */
49
+				[
50
+				'name'       => 'index',
51
+				'model'      => 'user',
52
+				'created_at' => \DB::raw('NOW()'),
53
+				'updated_at' => \DB::raw('NOW()')
54
+				],
55
+				[
56
+				'name'       => 'show',
57
+				'model'      => 'user',
58
+				'created_at' => \DB::raw('NOW()'),
59
+				'updated_at' => \DB::raw('NOW()')
60
+				],
61
+				[
62
+				'name'       => 'store',
63
+				'model'      => 'user',
64
+				'created_at' => \DB::raw('NOW()'),
65
+				'updated_at' => \DB::raw('NOW()')
66
+				],
67
+				[
68
+				'name'       => 'update',
69
+				'model'      => 'user',
70
+				'created_at' => \DB::raw('NOW()'),
71
+				'updated_at' => \DB::raw('NOW()')
72
+				],
73
+				[
74
+				'name'       => 'destroy',
75
+				'model'      => 'user',
76
+				'created_at' => \DB::raw('NOW()'),
77
+				'updated_at' => \DB::raw('NOW()')
78
+				],
79
+				[
80
+				'name'       => 'deleted',
81
+				'model'      => 'user',
82
+				'created_at' => \DB::raw('NOW()'),
83
+				'updated_at' => \DB::raw('NOW()')
84
+				],
85
+				[
86
+				'name'       => 'restore',
87
+				'model'      => 'user',
88
+				'created_at' => \DB::raw('NOW()'),
89
+				'updated_at' => \DB::raw('NOW()')
90
+				],
91
+				[
92
+				'name'       => 'assignRoles',
93
+				'model'      => 'user',
94
+				'created_at' => \DB::raw('NOW()'),
95
+				'updated_at' => \DB::raw('NOW()')
96
+				],
97
+				[
98
+				'name'       => 'block',
99
+				'model'      => 'user',
100
+				'created_at' => \DB::raw('NOW()'),
101
+				'updated_at' => \DB::raw('NOW()')
102
+				],
103
+				[
104
+				'name'       => 'unblock',
105
+				'model'      => 'user',
106
+				'created_at' => \DB::raw('NOW()'),
107
+				'updated_at' => \DB::raw('NOW()')
108
+				]
109
+			]
110
+		);
111
+	}
112 112
 }
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.