@@ -2,25 +2,25 @@ |
||
| 2 | 2 | |
| 3 | 3 | return [ |
| 4 | 4 | |
| 5 | - /** |
|
| 6 | - * List of error messages used in core module. |
|
| 7 | - */ |
|
| 8 | - 'unAuthorized' => 'من فضلك قم بتسجيل الدخول', |
|
| 9 | - 'invalidRefreshToken' => 'رمز التحديث غير صالح', |
|
| 10 | - 'noPermissions' => 'لا توجد صلاحية', |
|
| 11 | - 'loginFailed' => 'خطأ في البريد لاكتروني او كلمة المرور', |
|
| 12 | - 'noSocialEmail' => 'لا يمكن الحصول علي تابريد الاكتروني', |
|
| 13 | - 'userAlreadyRegistered' => 'المستخد مسجل بالفعل.سجل الدخول بالبريد الاكتروني و كلمة السر', |
|
| 14 | - 'connectionError' => 'خطأ في الاتصال', |
|
| 15 | - 'redisNotRunning' => 'سيرفير الاشعارات لايعمل', |
|
| 16 | - 'dbQueryError' => 'خطا في البيانات', |
|
| 17 | - 'cannotCreateSetting' => 'لا يمكن اضافة اعدادات', |
|
| 18 | - 'cannotUpdateSettingKey' => 'لا يمكن تعديل اعدادات', |
|
| 19 | - 'userIsBlocked' => 'لقد تم حظرك', |
|
| 20 | - 'invalidResetToken' => 'رمز تعديل كلمة المرور خطا', |
|
| 21 | - 'invalidResetPassword' => 'خطا في نعديل كلمة المرور', |
|
| 22 | - 'invalidOldPassword' => 'كلمة السر القديمه خطا', |
|
| 23 | - 'notFound' => 'ال :replace المطلوب غير موجود', |
|
| 24 | - 'generalError' => 'حدث خطا ما', |
|
| 5 | + /** |
|
| 6 | + * List of error messages used in core module. |
|
| 7 | + */ |
|
| 8 | + 'unAuthorized' => 'من فضلك قم بتسجيل الدخول', |
|
| 9 | + 'invalidRefreshToken' => 'رمز التحديث غير صالح', |
|
| 10 | + 'noPermissions' => 'لا توجد صلاحية', |
|
| 11 | + 'loginFailed' => 'خطأ في البريد لاكتروني او كلمة المرور', |
|
| 12 | + 'noSocialEmail' => 'لا يمكن الحصول علي تابريد الاكتروني', |
|
| 13 | + 'userAlreadyRegistered' => 'المستخد مسجل بالفعل.سجل الدخول بالبريد الاكتروني و كلمة السر', |
|
| 14 | + 'connectionError' => 'خطأ في الاتصال', |
|
| 15 | + 'redisNotRunning' => 'سيرفير الاشعارات لايعمل', |
|
| 16 | + 'dbQueryError' => 'خطا في البيانات', |
|
| 17 | + 'cannotCreateSetting' => 'لا يمكن اضافة اعدادات', |
|
| 18 | + 'cannotUpdateSettingKey' => 'لا يمكن تعديل اعدادات', |
|
| 19 | + 'userIsBlocked' => 'لقد تم حظرك', |
|
| 20 | + 'invalidResetToken' => 'رمز تعديل كلمة المرور خطا', |
|
| 21 | + 'invalidResetPassword' => 'خطا في نعديل كلمة المرور', |
|
| 22 | + 'invalidOldPassword' => 'كلمة السر القديمه خطا', |
|
| 23 | + 'notFound' => 'ال :replace المطلوب غير موجود', |
|
| 24 | + 'generalError' => 'حدث خطا ما', |
|
| 25 | 25 | |
| 26 | 26 | ]; |
| 27 | 27 | \ No newline at end of file |
@@ -8,35 +8,35 @@ |
||
| 8 | 8 | |
| 9 | 9 | class GroupsController extends BaseApiController |
| 10 | 10 | { |
| 11 | - /** |
|
| 12 | - * The name of the model that is used by the base api controller |
|
| 13 | - * to preform actions like (add, edit ... etc). |
|
| 14 | - * @var string |
|
| 15 | - */ |
|
| 16 | - protected $model = 'groups'; |
|
| 11 | + /** |
|
| 12 | + * The name of the model that is used by the base api controller |
|
| 13 | + * to preform actions like (add, edit ... etc). |
|
| 14 | + * @var string |
|
| 15 | + */ |
|
| 16 | + protected $model = 'groups'; |
|
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * The validations rules used by the base api controller |
|
| 20 | - * to check before add. |
|
| 21 | - * @var array |
|
| 22 | - */ |
|
| 23 | - protected $validationRules = [ |
|
| 24 | - 'name' => 'required|string|max:100|unique:groups,name,{id}' |
|
| 25 | - ]; |
|
| 18 | + /** |
|
| 19 | + * The validations rules used by the base api controller |
|
| 20 | + * to check before add. |
|
| 21 | + * @var array |
|
| 22 | + */ |
|
| 23 | + protected $validationRules = [ |
|
| 24 | + 'name' => 'required|string|max:100|unique:groups,name,{id}' |
|
| 25 | + ]; |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * Handle an assign permissions to group request. |
|
| 29 | - * |
|
| 30 | - * @param \Illuminate\Http\Request $request |
|
| 31 | - * @return \Illuminate\Http\Response |
|
| 32 | - */ |
|
| 33 | - public function assignpermissions(Request $request) |
|
| 34 | - { |
|
| 35 | - $this->validate($request, [ |
|
| 36 | - 'permission_ids' => 'required|exists:permissions,id', |
|
| 37 | - 'group_id' => 'required|array|exists:groups,id' |
|
| 38 | - ]); |
|
| 27 | + /** |
|
| 28 | + * Handle an assign permissions to group request. |
|
| 29 | + * |
|
| 30 | + * @param \Illuminate\Http\Request $request |
|
| 31 | + * @return \Illuminate\Http\Response |
|
| 32 | + */ |
|
| 33 | + public function assignpermissions(Request $request) |
|
| 34 | + { |
|
| 35 | + $this->validate($request, [ |
|
| 36 | + 'permission_ids' => 'required|exists:permissions,id', |
|
| 37 | + 'group_id' => 'required|array|exists:groups,id' |
|
| 38 | + ]); |
|
| 39 | 39 | |
| 40 | - return \Response::json($this->repo->assignPermissions($request->get('group_id'), $request->get('permission_ids')), 200); |
|
| 41 | - } |
|
| 40 | + return \Response::json($this->repo->assignPermissions($request->get('group_id'), $request->get('permission_ids')), 200); |
|
| 41 | + } |
|
| 42 | 42 | } |
@@ -14,27 +14,27 @@ |
||
| 14 | 14 | return 'App\Modules\V1\Acl\OauthClient'; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * Revoke the given client. |
|
| 19 | - * |
|
| 20 | - * @param integer $clientId |
|
| 21 | - * @return void |
|
| 22 | - */ |
|
| 23 | - public function revoke($clientId) |
|
| 24 | - { |
|
| 25 | - $client = $this->find($clientId); |
|
| 26 | - $client->tokens()->update(['revoked' => true]); |
|
| 27 | - $client->forceFill(['revoked' => true])->save(); |
|
| 28 | - } |
|
| 17 | + /** |
|
| 18 | + * Revoke the given client. |
|
| 19 | + * |
|
| 20 | + * @param integer $clientId |
|
| 21 | + * @return void |
|
| 22 | + */ |
|
| 23 | + public function revoke($clientId) |
|
| 24 | + { |
|
| 25 | + $client = $this->find($clientId); |
|
| 26 | + $client->tokens()->update(['revoked' => true]); |
|
| 27 | + $client->forceFill(['revoked' => true])->save(); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Revoke the given client. |
|
| 32 | - * |
|
| 33 | - * @param integer $clientId |
|
| 34 | - * @return void |
|
| 35 | - */ |
|
| 36 | - public function revoke($clientId) |
|
| 37 | - { |
|
| 30 | + /** |
|
| 31 | + * Revoke the given client. |
|
| 32 | + * |
|
| 33 | + * @param integer $clientId |
|
| 34 | + * @return void |
|
| 35 | + */ |
|
| 36 | + public function revoke($clientId) |
|
| 37 | + { |
|
| 38 | 38 | $this->update($clientId, ['secret' => str_random(40)]); |
| 39 | - } |
|
| 39 | + } |
|
| 40 | 40 | } |
@@ -6,23 +6,23 @@ |
||
| 6 | 6 | |
| 7 | 7 | class OauthClient extends Client |
| 8 | 8 | { |
| 9 | - protected $dates = ['created_at', 'updated_at']; |
|
| 10 | - protected $fillable = ['name', 'redirect', 'user_id', 'personal_access_client', 'password_client', 'revoked']; |
|
| 11 | - public $searchable = ['name']; |
|
| 9 | + protected $dates = ['created_at', 'updated_at']; |
|
| 10 | + protected $fillable = ['name', 'redirect', 'user_id', 'personal_access_client', 'password_client', 'revoked']; |
|
| 11 | + public $searchable = ['name']; |
|
| 12 | 12 | |
| 13 | - public function getCreatedAtAttribute($value) |
|
| 14 | - { |
|
| 15 | - return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 16 | - } |
|
| 13 | + public function getCreatedAtAttribute($value) |
|
| 14 | + { |
|
| 15 | + return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 16 | + } |
|
| 17 | 17 | |
| 18 | - public function getUpdatedAtAttribute($value) |
|
| 19 | - { |
|
| 20 | - return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 21 | - } |
|
| 18 | + public function getUpdatedAtAttribute($value) |
|
| 19 | + { |
|
| 20 | + return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - public static function boot() |
|
| 24 | - { |
|
| 25 | - parent::boot(); |
|
| 26 | - parent::observe(\App::make('App\Modules\V1\Acl\ModelObservers\OauthClientObserver')); |
|
| 27 | - } |
|
| 23 | + public static function boot() |
|
| 24 | + { |
|
| 25 | + parent::boot(); |
|
| 26 | + parent::observe(\App::make('App\Modules\V1\Acl\ModelObservers\OauthClientObserver')); |
|
| 27 | + } |
|
| 28 | 28 | } |
@@ -7,89 +7,89 @@ |
||
| 7 | 7 | |
| 8 | 8 | class AclUser extends User { |
| 9 | 9 | |
| 10 | - use SoftDeletes, HasApiTokens; |
|
| 11 | - protected $table = 'users'; |
|
| 12 | - protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
| 13 | - protected $hidden = ['password', 'remember_token','deleted_at']; |
|
| 14 | - protected $guarded = ['id']; |
|
| 15 | - protected $fillable = ['name', 'email', 'password']; |
|
| 16 | - public $searchable = ['name', 'email']; |
|
| 10 | + use SoftDeletes, HasApiTokens; |
|
| 11 | + protected $table = 'users'; |
|
| 12 | + protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
| 13 | + protected $hidden = ['password', 'remember_token','deleted_at']; |
|
| 14 | + protected $guarded = ['id']; |
|
| 15 | + protected $fillable = ['name', 'email', 'password']; |
|
| 16 | + public $searchable = ['name', 'email']; |
|
| 17 | 17 | |
| 18 | - public function getCreatedAtAttribute($value) |
|
| 19 | - { |
|
| 20 | - return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 21 | - } |
|
| 18 | + public function getCreatedAtAttribute($value) |
|
| 19 | + { |
|
| 20 | + return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - public function getUpdatedAtAttribute($value) |
|
| 24 | - { |
|
| 25 | - return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 26 | - } |
|
| 23 | + public function getUpdatedAtAttribute($value) |
|
| 24 | + { |
|
| 25 | + return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - public function getDeletedAtAttribute($value) |
|
| 29 | - { |
|
| 30 | - return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 31 | - } |
|
| 28 | + public function getDeletedAtAttribute($value) |
|
| 29 | + { |
|
| 30 | + return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * Encrypt the password attribute before |
|
| 35 | - * saving it in the storage. |
|
| 36 | - * |
|
| 37 | - * @param string $value |
|
| 38 | - */ |
|
| 39 | - public function setPasswordAttribute($value) |
|
| 40 | - { |
|
| 41 | - $this->attributes['password'] = bcrypt($value); |
|
| 42 | - } |
|
| 33 | + /** |
|
| 34 | + * Encrypt the password attribute before |
|
| 35 | + * saving it in the storage. |
|
| 36 | + * |
|
| 37 | + * @param string $value |
|
| 38 | + */ |
|
| 39 | + public function setPasswordAttribute($value) |
|
| 40 | + { |
|
| 41 | + $this->attributes['password'] = bcrypt($value); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - public function groups() |
|
| 45 | - { |
|
| 46 | - return $this->belongsToMany('\App\Modules\V1\Acl\AclGroup','users_groups','user_id','group_id')->whereNull('users_groups.deleted_at')->withTimestamps(); |
|
| 47 | - } |
|
| 44 | + public function groups() |
|
| 45 | + { |
|
| 46 | + return $this->belongsToMany('\App\Modules\V1\Acl\AclGroup','users_groups','user_id','group_id')->whereNull('users_groups.deleted_at')->withTimestamps(); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * Return fcm device tokens related to the user. |
|
| 51 | - * @return array |
|
| 52 | - */ |
|
| 53 | - public function routeNotificationForFCM() |
|
| 54 | - { |
|
| 55 | - $devices = \Core::pushNotificationsDevices()->findBy(['user_id' => $this->id]); |
|
| 56 | - $tokens = []; |
|
| 49 | + /** |
|
| 50 | + * Return fcm device tokens related to the user. |
|
| 51 | + * @return array |
|
| 52 | + */ |
|
| 53 | + public function routeNotificationForFCM() |
|
| 54 | + { |
|
| 55 | + $devices = \Core::pushNotificationsDevices()->findBy(['user_id' => $this->id]); |
|
| 56 | + $tokens = []; |
|
| 57 | 57 | |
| 58 | - foreach ($devices as $device) |
|
| 59 | - { |
|
| 60 | - $accessToken = decrypt($device->access_token); |
|
| 58 | + foreach ($devices as $device) |
|
| 59 | + { |
|
| 60 | + $accessToken = decrypt($device->access_token); |
|
| 61 | 61 | |
| 62 | - try |
|
| 63 | - { |
|
| 64 | - if (\Core::users()->accessTokenExpiredOrRevoked($accessToken)) |
|
| 65 | - { |
|
| 66 | - continue; |
|
| 67 | - } |
|
| 62 | + try |
|
| 63 | + { |
|
| 64 | + if (\Core::users()->accessTokenExpiredOrRevoked($accessToken)) |
|
| 65 | + { |
|
| 66 | + continue; |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - $tokens[] = $device->device_token; |
|
| 70 | - } |
|
| 71 | - catch (\Exception $e) |
|
| 72 | - { |
|
| 73 | - $device->forceDelete(); |
|
| 74 | - } |
|
| 75 | - } |
|
| 69 | + $tokens[] = $device->device_token; |
|
| 70 | + } |
|
| 71 | + catch (\Exception $e) |
|
| 72 | + { |
|
| 73 | + $device->forceDelete(); |
|
| 74 | + } |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - return $tokens; |
|
| 78 | - } |
|
| 77 | + return $tokens; |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * The channels the user receives notification broadcasts on. |
|
| 82 | - * |
|
| 83 | - * @return string |
|
| 84 | - */ |
|
| 85 | - public function receivesBroadcastNotificationsOn() |
|
| 86 | - { |
|
| 87 | - return 'users.' . $this->id; |
|
| 88 | - } |
|
| 80 | + /** |
|
| 81 | + * The channels the user receives notification broadcasts on. |
|
| 82 | + * |
|
| 83 | + * @return string |
|
| 84 | + */ |
|
| 85 | + public function receivesBroadcastNotificationsOn() |
|
| 86 | + { |
|
| 87 | + return 'users.' . $this->id; |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - public static function boot() |
|
| 91 | - { |
|
| 92 | - parent::boot(); |
|
| 93 | - parent::observe(\App::make('App\Modules\V1\Acl\ModelObservers\AclUserObserver')); |
|
| 94 | - } |
|
| 90 | + public static function boot() |
|
| 91 | + { |
|
| 92 | + parent::boot(); |
|
| 93 | + parent::observe(\App::make('App\Modules\V1\Acl\ModelObservers\AclUserObserver')); |
|
| 94 | + } |
|
| 95 | 95 | } |
@@ -5,66 +5,66 @@ |
||
| 5 | 5 | */ |
| 6 | 6 | class AclUserObserver { |
| 7 | 7 | |
| 8 | - public function saving($model) |
|
| 9 | - { |
|
| 10 | - // |
|
| 11 | - } |
|
| 8 | + public function saving($model) |
|
| 9 | + { |
|
| 10 | + // |
|
| 11 | + } |
|
| 12 | 12 | |
| 13 | - public function saved($model) |
|
| 14 | - { |
|
| 15 | - // |
|
| 16 | - } |
|
| 13 | + public function saved($model) |
|
| 14 | + { |
|
| 15 | + // |
|
| 16 | + } |
|
| 17 | 17 | |
| 18 | - public function creating($model) |
|
| 19 | - { |
|
| 20 | - // |
|
| 21 | - } |
|
| 18 | + public function creating($model) |
|
| 19 | + { |
|
| 20 | + // |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - public function created($model) |
|
| 24 | - { |
|
| 25 | - // |
|
| 26 | - } |
|
| 23 | + public function created($model) |
|
| 24 | + { |
|
| 25 | + // |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - public function updating($model) |
|
| 29 | - { |
|
| 30 | - if ($model->password) |
|
| 31 | - { |
|
| 32 | - $model->last_change_password = \Carbon\Carbon::now()->toDateTimeString(); |
|
| 33 | - } |
|
| 34 | - } |
|
| 28 | + public function updating($model) |
|
| 29 | + { |
|
| 30 | + if ($model->password) |
|
| 31 | + { |
|
| 32 | + $model->last_change_password = \Carbon\Carbon::now()->toDateTimeString(); |
|
| 33 | + } |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - public function updated($model) |
|
| 37 | - { |
|
| 38 | - // |
|
| 39 | - } |
|
| 36 | + public function updated($model) |
|
| 37 | + { |
|
| 38 | + // |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Soft delete user logs. |
|
| 43 | - * |
|
| 44 | - * @param object $model the delted model. |
|
| 45 | - * @return void |
|
| 46 | - */ |
|
| 47 | - public function deleting($model) |
|
| 48 | - { |
|
| 49 | - if ($model->getOriginal('id') == \Auth::id()) |
|
| 50 | - { |
|
| 51 | - \ErrorHandler::noPermissions(); |
|
| 52 | - } |
|
| 53 | - $model->logs()->delete(); |
|
| 54 | - } |
|
| 41 | + /** |
|
| 42 | + * Soft delete user logs. |
|
| 43 | + * |
|
| 44 | + * @param object $model the delted model. |
|
| 45 | + * @return void |
|
| 46 | + */ |
|
| 47 | + public function deleting($model) |
|
| 48 | + { |
|
| 49 | + if ($model->getOriginal('id') == \Auth::id()) |
|
| 50 | + { |
|
| 51 | + \ErrorHandler::noPermissions(); |
|
| 52 | + } |
|
| 53 | + $model->logs()->delete(); |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - public function deleted($model) |
|
| 57 | - { |
|
| 58 | - // |
|
| 59 | - } |
|
| 56 | + public function deleted($model) |
|
| 57 | + { |
|
| 58 | + // |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - public function restoring($model) |
|
| 62 | - { |
|
| 63 | - $model->logs()->restore(); |
|
| 64 | - } |
|
| 61 | + public function restoring($model) |
|
| 62 | + { |
|
| 63 | + $model->logs()->restore(); |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - public function restored($model) |
|
| 67 | - { |
|
| 68 | - // |
|
| 69 | - } |
|
| 66 | + public function restored($model) |
|
| 67 | + { |
|
| 68 | + // |
|
| 69 | + } |
|
| 70 | 70 | } |
| 71 | 71 | \ No newline at end of file |
@@ -5,53 +5,53 @@ |
||
| 5 | 5 | */ |
| 6 | 6 | class OauthClientObserver { |
| 7 | 7 | |
| 8 | - public function saving($model) |
|
| 9 | - { |
|
| 10 | - // |
|
| 11 | - } |
|
| 12 | - |
|
| 13 | - public function saved($model) |
|
| 14 | - { |
|
| 15 | - // |
|
| 16 | - } |
|
| 17 | - |
|
| 18 | - public function creating($model) |
|
| 19 | - { |
|
| 20 | - $model->secret = str_random(40); |
|
| 21 | - } |
|
| 22 | - |
|
| 23 | - public function created($model) |
|
| 24 | - { |
|
| 25 | - // |
|
| 26 | - } |
|
| 27 | - |
|
| 28 | - public function updating($model) |
|
| 29 | - { |
|
| 30 | - // |
|
| 31 | - } |
|
| 32 | - |
|
| 33 | - public function updated($model) |
|
| 34 | - { |
|
| 35 | - // |
|
| 36 | - } |
|
| 37 | - |
|
| 38 | - public function deleting($model) |
|
| 39 | - { |
|
| 40 | - // |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - public function deleted($model) |
|
| 44 | - { |
|
| 45 | - // |
|
| 46 | - } |
|
| 47 | - |
|
| 48 | - public function restoring($model) |
|
| 49 | - { |
|
| 50 | - // |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - public function restored($model) |
|
| 54 | - { |
|
| 55 | - // |
|
| 56 | - } |
|
| 8 | + public function saving($model) |
|
| 9 | + { |
|
| 10 | + // |
|
| 11 | + } |
|
| 12 | + |
|
| 13 | + public function saved($model) |
|
| 14 | + { |
|
| 15 | + // |
|
| 16 | + } |
|
| 17 | + |
|
| 18 | + public function creating($model) |
|
| 19 | + { |
|
| 20 | + $model->secret = str_random(40); |
|
| 21 | + } |
|
| 22 | + |
|
| 23 | + public function created($model) |
|
| 24 | + { |
|
| 25 | + // |
|
| 26 | + } |
|
| 27 | + |
|
| 28 | + public function updating($model) |
|
| 29 | + { |
|
| 30 | + // |
|
| 31 | + } |
|
| 32 | + |
|
| 33 | + public function updated($model) |
|
| 34 | + { |
|
| 35 | + // |
|
| 36 | + } |
|
| 37 | + |
|
| 38 | + public function deleting($model) |
|
| 39 | + { |
|
| 40 | + // |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + public function deleted($model) |
|
| 44 | + { |
|
| 45 | + // |
|
| 46 | + } |
|
| 47 | + |
|
| 48 | + public function restoring($model) |
|
| 49 | + { |
|
| 50 | + // |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + public function restored($model) |
|
| 54 | + { |
|
| 55 | + // |
|
| 56 | + } |
|
| 57 | 57 | } |
| 58 | 58 | \ No newline at end of file |
@@ -6,14 +6,14 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | class AssignRelationsSeeder extends Seeder |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Run the database seeds. |
|
| 11 | - * |
|
| 12 | - * @return void |
|
| 13 | - */ |
|
| 14 | - public function run() |
|
| 15 | - { |
|
| 16 | - $adminGroupId = \DB::table('groups')->where('name', 'admin')->select('id')->first()->id; |
|
| 9 | + /** |
|
| 10 | + * Run the database seeds. |
|
| 11 | + * |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function run() |
|
| 15 | + { |
|
| 16 | + $adminGroupId = \DB::table('groups')->where('name', 'admin')->select('id')->first()->id; |
|
| 17 | 17 | $adminUserId = \DB::table('users')->where('email', '[email protected]')->select('id')->first()->id; |
| 18 | 18 | |
| 19 | 19 | /** |
@@ -26,13 +26,13 @@ discard block |
||
| 26 | 26 | 'created_at' => \DB::raw('NOW()'), |
| 27 | 27 | 'updated_at' => \DB::raw('NOW()') |
| 28 | 28 | ] |
| 29 | - ); |
|
| 29 | + ); |
|
| 30 | 30 | |
| 31 | - /** |
|
| 31 | + /** |
|
| 32 | 32 | * Assign the permissions to the admin group. |
| 33 | 33 | */ |
| 34 | - \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['users', 'permissions', 'groups', 'oauthClients'])->each(function ($permission) use ($adminGroupId) { |
|
| 35 | - \DB::table('groups_permissions')->insert( |
|
| 34 | + \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['users', 'permissions', 'groups', 'oauthClients'])->each(function ($permission) use ($adminGroupId) { |
|
| 35 | + \DB::table('groups_permissions')->insert( |
|
| 36 | 36 | [ |
| 37 | 37 | 'permission_id' => $permission->id, |
| 38 | 38 | 'group_id' => $adminGroupId, |
@@ -40,6 +40,6 @@ discard block |
||
| 40 | 40 | 'updated_at' => \DB::raw('NOW()') |
| 41 | 41 | ] |
| 42 | 42 | ); |
| 43 | - }); |
|
| 44 | - } |
|
| 43 | + }); |
|
| 44 | + } |
|
| 45 | 45 | } |
@@ -6,18 +6,18 @@ |
||
| 6 | 6 | |
| 7 | 7 | class AclDatabaseSeeder extends Seeder |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Run the database seeds. |
|
| 11 | - * |
|
| 12 | - * @return void |
|
| 13 | - */ |
|
| 14 | - public function run() |
|
| 15 | - { |
|
| 16 | - $this->call(ClearDataSeeder::class); |
|
| 17 | - $this->call(UsersTableSeeder::class); |
|
| 18 | - $this->call(GroupsTableSeeder::class); |
|
| 19 | - $this->call(PermissionsTableSeeder::class); |
|
| 20 | - $this->call(OauthClientsTableSeeder::class); |
|
| 21 | - $this->call(AssignRelationsSeeder::class); |
|
| 22 | - } |
|
| 9 | + /** |
|
| 10 | + * Run the database seeds. |
|
| 11 | + * |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function run() |
|
| 15 | + { |
|
| 16 | + $this->call(ClearDataSeeder::class); |
|
| 17 | + $this->call(UsersTableSeeder::class); |
|
| 18 | + $this->call(GroupsTableSeeder::class); |
|
| 19 | + $this->call(PermissionsTableSeeder::class); |
|
| 20 | + $this->call(OauthClientsTableSeeder::class); |
|
| 21 | + $this->call(AssignRelationsSeeder::class); |
|
| 22 | + } |
|
| 23 | 23 | } |