@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * to preform actions like (add, edit ... etc). |
14 | 14 | * @var string |
15 | 15 | */ |
16 | - protected $model = 'users'; |
|
16 | + protected $model = 'users'; |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * List of all route actions that the base api controller |
@@ -27,14 +27,14 @@ discard block |
||
27 | 27 | * will skip login check for them. |
28 | 28 | * @var array |
29 | 29 | */ |
30 | - protected $skipLoginCheck = ['login', 'loginSocial', 'register', 'sendreset', 'resetpassword', 'refreshtoken', 'confirmEmail', 'resendEmailConfirmation']; |
|
30 | + protected $skipLoginCheck = ['login', 'loginSocial', 'register', 'sendreset', 'resetpassword', 'refreshtoken', 'confirmEmail', 'resendEmailConfirmation']; |
|
31 | 31 | |
32 | 32 | /** |
33 | 33 | * The validations rules used by the base api controller |
34 | 34 | * to check before add. |
35 | 35 | * @var array |
36 | 36 | */ |
37 | - protected $validationRules = [ |
|
37 | + protected $validationRules = [ |
|
38 | 38 | 'name' => 'nullable|string', |
39 | 39 | 'email' => 'required|email|unique:users,email,{id}', |
40 | 40 | 'password' => 'nullable|min:6' |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | $this->validate($request, [ |
282 | 282 | 'profile_picture' => 'nullable|string', |
283 | 283 | 'name' => 'nullable|string', |
284 | - 'email' => 'required|email|unique:users,email,' . \Auth::id() |
|
284 | + 'email' => 'required|email|unique:users,email,'.\Auth::id() |
|
285 | 285 | ]); |
286 | 286 | |
287 | 287 | return \Response::json($this->repo->saveProfile($request->only('name', 'email', 'profile_picture')), 200); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $user = \Core::users()->find(\Auth::id(), $relations); |
29 | 29 | foreach ($user->groups()->get() as $group) |
30 | 30 | { |
31 | - $group->permissions->each(function ($permission) use (&$permissions){ |
|
31 | + $group->permissions->each(function($permission) use (&$permissions){ |
|
32 | 32 | $permissions[$permission->model][$permission->id] = $permission->name; |
33 | 33 | }); |
34 | 34 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $user = $user ?: $this->find(\Auth::id(), ['groups.permissions']); |
52 | 52 | $permissions = []; |
53 | 53 | |
54 | - $user->groups->pluck('permissions')->each(function ($permission) use (&$permissions, $model){ |
|
54 | + $user->groups->pluck('permissions')->each(function($permission) use (&$permissions, $model){ |
|
55 | 55 | $permissions = array_merge($permissions, $permission->where('model', $model)->pluck('name')->toArray()); |
56 | 56 | }); |
57 | 57 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function assignGroups($userId, $groupIds) |
82 | 82 | { |
83 | - \DB::transaction(function () use ($userId, $groupIds) { |
|
83 | + \DB::transaction(function() use ($userId, $groupIds) { |
|
84 | 84 | $user = $this->find($userId); |
85 | 85 | $user->groups()->detach(); |
86 | 86 | $user->groups()->attach($groupIds); |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | */ |
251 | 251 | public function resetPassword($credentials) |
252 | 252 | { |
253 | - $response = \Password::reset($credentials, function ($user, $password) { |
|
253 | + $response = \Password::reset($credentials, function($user, $password) { |
|
254 | 254 | $user->password = $password; |
255 | 255 | $user->save(); |
256 | 256 | }); |
@@ -11,13 +11,13 @@ discard block |
||
11 | 11 | */ |
12 | 12 | public function uploadImage($image, $dir) |
13 | 13 | { |
14 | - $imageName = str_slug('image' . uniqid() . time() . '_' . $image->getClientOriginalName()); |
|
15 | - $destinationPath = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR; |
|
14 | + $imageName = str_slug('image'.uniqid().time().'_'.$image->getClientOriginalName()); |
|
15 | + $destinationPath = 'media'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR; |
|
16 | 16 | |
17 | 17 | ! file_exists($destinationPath) ? \File::makeDirectory($destinationPath) : false; |
18 | 18 | $image->move($destinationPath, $imageName); |
19 | 19 | |
20 | - return url($destinationPath . $imageName); |
|
20 | + return url($destinationPath.$imageName); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
@@ -29,20 +29,20 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function uploadImageBas64($image, $dir) |
31 | 31 | { |
32 | - if (! strlen($image)) |
|
32 | + if ( ! strlen($image)) |
|
33 | 33 | { |
34 | 34 | return null; |
35 | 35 | } |
36 | 36 | |
37 | - $imageName = 'image' . uniqid() . time() . '.jpg'; |
|
38 | - $destinationPath = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR; |
|
37 | + $imageName = 'image'.uniqid().time().'.jpg'; |
|
38 | + $destinationPath = 'media'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR; |
|
39 | 39 | |
40 | 40 | ! file_exists($destinationPath) ? \File::makeDirectory($destinationPath) : false; |
41 | 41 | |
42 | - $base = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $image)); |
|
43 | - \Image::make($base)->save($destinationPath . $imageName); |
|
42 | + $base = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $image)); |
|
43 | + \Image::make($base)->save($destinationPath.$imageName); |
|
44 | 44 | |
45 | - return url($destinationPath . $imageName); |
|
45 | + return url($destinationPath.$imageName); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | public function deleteImage($path, $dir) |
56 | 56 | { |
57 | 57 | $arr = explode('/', $path); |
58 | - $path = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR . end($arr); |
|
58 | + $path = 'media'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.end($arr); |
|
59 | 59 | if (\File::exists($path)) |
60 | 60 | { |
61 | 61 | \File::delete($path); |