@@ -12,7 +12,7 @@ |
||
12 | 12 | */ |
13 | 13 | public function up() |
14 | 14 | { |
15 | - Schema::create('users', function (Blueprint $table) { |
|
15 | + Schema::create('users', function(Blueprint $table) { |
|
16 | 16 | $table->increments('id'); |
17 | 17 | $table->string('profile_picture', 150)->nullable(); |
18 | 18 | $table->string('name', 100)->nullable(); |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -$factory->define(App\Modules\V1\Acl\AclUser::class, function (Faker\Generator $faker) { |
|
3 | +$factory->define(App\Modules\V1\Acl\AclUser::class, function(Faker\Generator $faker) { |
|
4 | 4 | return [ |
5 | 5 | 'profile_picture' => 'http://lorempixel.com/400/200/', |
6 | 6 | 'name' => $faker->name(), |
@@ -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' |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | $this->validate($request, [ |
281 | 281 | 'profile_picture' => 'nullable|base64image', |
282 | 282 | 'name' => 'nullable|string', |
283 | - 'email' => 'required|email|unique:users,email,' . \Auth::id() |
|
283 | + 'email' => 'required|email|unique:users,email,'.\Auth::id() |
|
284 | 284 | ]); |
285 | 285 | |
286 | 286 | return \Response::json($this->repo->saveProfile($request->only('name', 'email')), 200); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | use SoftDeletes, HasApiTokens; |
11 | 11 | protected $table = 'users'; |
12 | 12 | protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
13 | - protected $hidden = ['password', 'remember_token','deleted_at', 'two_factor_code']; |
|
13 | + protected $hidden = ['password', 'remember_token', 'deleted_at', 'two_factor_code']; |
|
14 | 14 | protected $guarded = ['id']; |
15 | 15 | protected $fillable = ['profile_picture', 'name', 'email', 'password']; |
16 | 16 | public $searchable = ['name', 'email']; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | public function groups() |
69 | 69 | { |
70 | - return $this->belongsToMany('\App\Modules\V1\Acl\AclGroup','users_groups','user_id','group_id')->whereNull('users_groups.deleted_at')->withTimestamps(); |
|
70 | + return $this->belongsToMany('\App\Modules\V1\Acl\AclGroup', 'users_groups', 'user_id', 'group_id')->whereNull('users_groups.deleted_at')->withTimestamps(); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | public function oauthClients() |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function receivesBroadcastNotificationsOn() |
116 | 116 | { |
117 | - return 'users.' . $this->id; |
|
117 | + return 'users.'.$this->id; |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | public static function boot() |
@@ -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 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function assignGroups($user_id, $group_ids) |
83 | 83 | { |
84 | - \DB::transaction(function () use ($user_id, $group_ids) { |
|
84 | + \DB::transaction(function() use ($user_id, $group_ids) { |
|
85 | 85 | $user = $this->find($user_id); |
86 | 86 | $user->groups()->detach(); |
87 | 87 | $user->groups()->attach($group_ids); |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | */ |
249 | 249 | public function resetPassword($credentials) |
250 | 250 | { |
251 | - $response = \Password::reset($credentials, function ($user, $password) { |
|
251 | + $response = \Password::reset($credentials, function($user, $password) { |
|
252 | 252 | $user->password = $password; |
253 | 253 | $user->save(); |
254 | 254 | }); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | return new \App\Modules\V1\Core\Utl\Media; |
52 | 52 | }); |
53 | 53 | |
54 | - \Validator::extend('base64image', function ($attribute, $value, $parameters, $validator) { |
|
54 | + \Validator::extend('base64image', function($attribute, $value, $parameters, $validator) { |
|
55 | 55 | $explode = explode(',', $value); |
56 | 56 | $allow = ['png', 'jpg', 'svg']; |
57 | 57 | $format = str_replace( |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | $explode[0] |
67 | 67 | ); |
68 | 68 | // check file format |
69 | - if (!in_array($format, $allow)) { |
|
69 | + if ( ! in_array($format, $allow)) { |
|
70 | 70 | return false; |
71 | 71 | } |
72 | 72 | // check base64 format |
73 | - if (!preg_match('%^[a-zA-Z0-9/+]*={0,2}$%', $explode[1])) { |
|
73 | + if ( ! preg_match('%^[a-zA-Z0-9/+]*={0,2}$%', $explode[1])) { |
|
74 | 74 | return false; |
75 | 75 | } |
76 | 76 | return true; |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | { |
14 | 14 | $response = []; |
15 | 15 | $image = $image; |
16 | - $imageName = str_slug('image' . uniqid() . time() . '_' . $image->getClientOriginalName()); |
|
17 | - $destinationPath = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR; |
|
16 | + $imageName = str_slug('image'.uniqid().time().'_'.$image->getClientOriginalName()); |
|
17 | + $destinationPath = 'media'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR; |
|
18 | 18 | |
19 | 19 | ! file_exists($destinationPath) ? \File::makeDirectory($destinationPath) : false; |
20 | 20 | $image->move($destinationPath, $imageName); |
21 | 21 | |
22 | - return url($destinationPath . $imageName); |
|
22 | + return url($destinationPath.$imageName); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
@@ -33,15 +33,15 @@ discard block |
||
33 | 33 | { |
34 | 34 | $response = []; |
35 | 35 | $image = $image; |
36 | - $imageName = 'image' . uniqid() . time() . '.jpg'; |
|
37 | - $destinationPath = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR; |
|
36 | + $imageName = 'image'.uniqid().time().'.jpg'; |
|
37 | + $destinationPath = 'media'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR; |
|
38 | 38 | |
39 | 39 | ! file_exists($destinationPath) ? \File::makeDirectory($destinationPath) : false; |
40 | 40 | |
41 | 41 | $base = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $image)); |
42 | - $image = \Image::make($base)->save($destinationPath . $imageName); |
|
42 | + $image = \Image::make($base)->save($destinationPath.$imageName); |
|
43 | 43 | |
44 | - return url($destinationPath . $imageName); |
|
44 | + return url($destinationPath.$imageName); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | public function deleteImage($path, $dir) |
55 | 55 | { |
56 | 56 | $arr = explode('/', $path); |
57 | - $path = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR . end($arr); |
|
57 | + $path = 'media'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.end($arr); |
|
58 | 58 | if (\File::exists($path)) |
59 | 59 | { |
60 | 60 | \File::delete($path); |
@@ -47,6 +47,6 @@ |
||
47 | 47 | ->subject('Reset passowrd') |
48 | 48 | ->line('Reset passowrd') |
49 | 49 | ->line('To reset your password click on the button below') |
50 | - ->action('Reset password', env('RESET_PASSWORD_URL') . '/' . $this->token); |
|
50 | + ->action('Reset password', env('RESET_PASSWORD_URL').'/'.$this->token); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | \ No newline at end of file |
@@ -45,6 +45,6 @@ |
||
45 | 45 | ->subject('Email verification') |
46 | 46 | ->line('Email verification') |
47 | 47 | ->line('To validate your email click on the button below') |
48 | - ->action('Verify your email', env('CONFIRM_EMAIL_URL') . '/' . $notifiable->confirmation_code)); |
|
48 | + ->action('Verify your email', env('CONFIRM_EMAIL_URL').'/'.$notifiable->confirmation_code)); |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 | \ No newline at end of file |