@@ -13,14 +13,14 @@ |
||
13 | 13 | * to preform actions like (add, edit ... etc). |
14 | 14 | * @var string |
15 | 15 | */ |
16 | - protected $model = 'groups'; |
|
16 | + protected $model = 'groups'; |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * The validations rules used by the base api controller |
20 | 20 | * to check before add. |
21 | 21 | * @var array |
22 | 22 | */ |
23 | - protected $validationRules = [ |
|
23 | + protected $validationRules = [ |
|
24 | 24 | 'name' => 'required|string|max:100|unique:groups,name,{id}' |
25 | 25 | ]; |
26 | 26 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | use SoftDeletes; |
10 | 10 | protected $table = 'users'; |
11 | 11 | protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
12 | - protected $hidden = ['password', 'remember_token','deleted_at']; |
|
12 | + protected $hidden = ['password', 'remember_token', 'deleted_at']; |
|
13 | 13 | protected $guarded = ['id']; |
14 | 14 | protected $fillable = ['first_name', 'last_name', 'user_name', 'address', 'email', 'password']; |
15 | 15 | protected $appends = ['permissions']; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | public function groups() |
49 | 49 | { |
50 | - return $this->belongsToMany('\App\Modules\V1\Acl\AclGroup','users_groups','user_id','group_id')->whereNull('users_groups.deleted_at')->withTimestamps(); |
|
50 | + return $this->belongsToMany('\App\Modules\V1\Acl\AclGroup', 'users_groups', 'user_id', 'group_id')->whereNull('users_groups.deleted_at')->withTimestamps(); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | public function getPermissionsAttribute() |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $permissions = []; |
56 | 56 | foreach ($this->groups as $group) |
57 | 57 | { |
58 | - $group->permissions->each(function ($permission) use (&$permissions){ |
|
58 | + $group->permissions->each(function($permission) use (&$permissions){ |
|
59 | 59 | $permissions[$permission->model][$permission->id] = $permission->name; |
60 | 60 | }); |
61 | 61 | } |
@@ -70,7 +70,7 @@ |
||
70 | 70 | |
71 | 71 | public function notFound($text) |
72 | 72 | { |
73 | - $error = ['status' => 404, 'message' => 'The requested ' . $text . ' not found']; |
|
73 | + $error = ['status' => 404, 'message' => 'The requested '.$text.' not found']; |
|
74 | 74 | abort($error['status'], $error['message']); |
75 | 75 | } |
76 | 76 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * to preform actions like (add, edit ... etc). |
13 | 13 | * @var string |
14 | 14 | */ |
15 | - protected $model = 'users'; |
|
15 | + protected $model = 'users'; |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * List of all route actions that the base api controller |
@@ -26,14 +26,14 @@ discard block |
||
26 | 26 | * will skip login check for them. |
27 | 27 | * @var array |
28 | 28 | */ |
29 | - protected $skipLoginCheck = ['login', 'register', 'sendreset', 'resetpassword']; |
|
29 | + protected $skipLoginCheck = ['login', 'register', 'sendreset', 'resetpassword']; |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * The validations rules used by the base api controller |
33 | 33 | * to check before add. |
34 | 34 | * @var array |
35 | 35 | */ |
36 | - protected $validationRules = [ |
|
36 | + protected $validationRules = [ |
|
37 | 37 | 'email' => 'required|email|unique:users,email,{id}', |
38 | 38 | 'password' => 'min:6' |
39 | 39 | ]; |
@@ -23,11 +23,11 @@ discard block |
||
23 | 23 | * @param boolean $user |
24 | 24 | * @return boolean |
25 | 25 | */ |
26 | - public function can($nameOfPermission, $model, $user = false ) |
|
26 | + public function can($nameOfPermission, $model, $user = false) |
|
27 | 27 | { |
28 | 28 | $user = $user ?: \JWTAuth::parseToken()->authenticate(); |
29 | 29 | $permissions = []; |
30 | - \Core::users()->find($user->id, ['groups.permissions'])->groups->lists('permissions')->each(function ($permission) use (&$permissions, $model){ |
|
30 | + \Core::users()->find($user->id, ['groups.permissions'])->groups->lists('permissions')->each(function($permission) use (&$permissions, $model){ |
|
31 | 31 | $permissions = array_merge($permissions, $permission->where('model', $model)->lists('name')->toArray()); |
32 | 32 | }); |
33 | 33 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function assignGroups($user_id, $group_ids) |
57 | 57 | { |
58 | - \DB::transaction(function () use ($user_id, $group_ids) { |
|
58 | + \DB::transaction(function() use ($user_id, $group_ids) { |
|
59 | 59 | $user = \Core::users()->find($user_id); |
60 | 60 | $user->groups()->detach(); |
61 | 61 | $user->groups()->attach($group_ids); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | */ |
188 | 188 | public function sendReset($email) |
189 | 189 | { |
190 | - $response = \Password::sendResetLink($email, function (\Illuminate\Mail\Message $message) { |
|
190 | + $response = \Password::sendResetLink($email, function(\Illuminate\Mail\Message $message) { |
|
191 | 191 | $message->subject('Your Password Reset Link'); |
192 | 192 | }); |
193 | 193 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | public function resetPassword($credentials) |
208 | 208 | { |
209 | 209 | $token = false; |
210 | - $response = \Password::reset($credentials, function ($user, $password) use (&$token) { |
|
210 | + $response = \Password::reset($credentials, function($user, $password) use (&$token) { |
|
211 | 211 | $user->password = $password; |
212 | 212 | $user->save(); |
213 | 213 |
@@ -12,7 +12,7 @@ |
||
12 | 12 | */ |
13 | 13 | public function up() |
14 | 14 | { |
15 | - Schema::create('password_resets', function (Blueprint $table) { |
|
15 | + Schema::create('password_resets', function(Blueprint $table) { |
|
16 | 16 | $table->string('email')->index(); |
17 | 17 | $table->string('token')->index(); |
18 | 18 | $table->timestamp('created_at'); |
@@ -12,9 +12,9 @@ |
||
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 | - $table->string('name',100)->nullable(); |
|
17 | + $table->string('name', 100)->nullable(); |
|
18 | 18 | $table->string('email')->unique(); |
19 | 19 | $table->string('password', 60); |
20 | 20 | $table->boolean('blocked', 0); |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | use App\Modules\V1\Core\AbstractRepositories\AbstractRepositoryContainer; |
4 | 4 | |
5 | -class Core extends AbstractRepositoryContainer{ |
|
5 | +class Core extends AbstractRepositoryContainer { |
|
6 | 6 | /** |
7 | 7 | * Specify module repositories name space. |
8 | 8 | * |
@@ -159,7 +159,7 @@ |
||
159 | 159 | */ |
160 | 160 | public function down() |
161 | 161 | { |
162 | - $permissions = DB::table('permissions')->whereIn('model', ['settings']); |
|
162 | + $permissions = DB::table('permissions')->whereIn('model', ['settings']); |
|
163 | 163 | DB::table('groups_permissions')->whereIn('permission_id', $permissions->lists('id'))->delete(); |
164 | 164 | $permissions->delete(); |
165 | 165 | } |