@@ -1,6 +1,5 @@ |
||
| 1 | 1 | <?php namespace App\Modules\Acl; |
| 2 | 2 | |
| 3 | -use Illuminate\Database\Eloquent\Model; |
|
| 4 | 3 | use App\User; |
| 5 | 4 | use Illuminate\Database\Eloquent\SoftDeletes; |
| 6 | 5 | |
@@ -6,66 +6,66 @@ |
||
| 6 | 6 | |
| 7 | 7 | class AclUser extends User { |
| 8 | 8 | |
| 9 | - use SoftDeletes; |
|
| 10 | - protected $table = 'users'; |
|
| 11 | - protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
| 12 | - protected $hidden = ['password', 'remember_token','deleted_at']; |
|
| 13 | - protected $guarded = ['id']; |
|
| 14 | - protected $fillable = ['first_name', 'last_name', 'user_name', 'address', 'email', 'password']; |
|
| 15 | - protected $appends = ['permissions']; |
|
| 9 | + use SoftDeletes; |
|
| 10 | + protected $table = 'users'; |
|
| 11 | + protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
| 12 | + protected $hidden = ['password', 'remember_token','deleted_at']; |
|
| 13 | + protected $guarded = ['id']; |
|
| 14 | + protected $fillable = ['first_name', 'last_name', 'user_name', 'address', 'email', 'password']; |
|
| 15 | + protected $appends = ['permissions']; |
|
| 16 | 16 | |
| 17 | - public function getCreatedAtAttribute($value) |
|
| 18 | - { |
|
| 19 | - return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 20 | - } |
|
| 17 | + public function getCreatedAtAttribute($value) |
|
| 18 | + { |
|
| 19 | + return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | - public function getUpdatedAtAttribute($value) |
|
| 23 | - { |
|
| 24 | - return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 25 | - } |
|
| 22 | + public function getUpdatedAtAttribute($value) |
|
| 23 | + { |
|
| 24 | + return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - public function getDeletedAtAttribute($value) |
|
| 28 | - { |
|
| 29 | - return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 30 | - } |
|
| 27 | + public function getDeletedAtAttribute($value) |
|
| 28 | + { |
|
| 29 | + return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * Encrypt the password attribute before |
|
| 34 | - * saving it in the storage. |
|
| 35 | - * |
|
| 36 | - * @param string $value |
|
| 37 | - */ |
|
| 38 | - public function setPasswordAttribute($value) |
|
| 39 | - { |
|
| 40 | - $this->attributes['password'] = bcrypt($value); |
|
| 41 | - } |
|
| 32 | + /** |
|
| 33 | + * Encrypt the password attribute before |
|
| 34 | + * saving it in the storage. |
|
| 35 | + * |
|
| 36 | + * @param string $value |
|
| 37 | + */ |
|
| 38 | + public function setPasswordAttribute($value) |
|
| 39 | + { |
|
| 40 | + $this->attributes['password'] = bcrypt($value); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - public function logs() |
|
| 44 | - { |
|
| 45 | - return $this->hasMany('App\Modules\Logging\Log', 'user_id'); |
|
| 46 | - } |
|
| 43 | + public function logs() |
|
| 44 | + { |
|
| 45 | + return $this->hasMany('App\Modules\Logging\Log', 'user_id'); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - public function groups() |
|
| 49 | - { |
|
| 50 | - return $this->belongsToMany('\App\Modules\Acl\AclGroup','users_groups','user_id','group_id')->whereNull('users_groups.deleted_at')->withTimestamps(); |
|
| 51 | - } |
|
| 48 | + public function groups() |
|
| 49 | + { |
|
| 50 | + return $this->belongsToMany('\App\Modules\Acl\AclGroup','users_groups','user_id','group_id')->whereNull('users_groups.deleted_at')->withTimestamps(); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - public function getPermissionsAttribute() |
|
| 54 | - { |
|
| 55 | - $permissions = []; |
|
| 56 | - foreach ($this->groups as $group) |
|
| 57 | - { |
|
| 58 | - $group->permissions->each(function ($permission) use (&$permissions){ |
|
| 59 | - $permissions[$permission->model][$permission->id] = $permission->name; |
|
| 60 | - }); |
|
| 61 | - } |
|
| 53 | + public function getPermissionsAttribute() |
|
| 54 | + { |
|
| 55 | + $permissions = []; |
|
| 56 | + foreach ($this->groups as $group) |
|
| 57 | + { |
|
| 58 | + $group->permissions->each(function ($permission) use (&$permissions){ |
|
| 59 | + $permissions[$permission->model][$permission->id] = $permission->name; |
|
| 60 | + }); |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - return \Illuminate\Database\Eloquent\Collection::make($permissions); |
|
| 64 | - } |
|
| 63 | + return \Illuminate\Database\Eloquent\Collection::make($permissions); |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - public static function boot() |
|
| 67 | - { |
|
| 68 | - parent::boot(); |
|
| 69 | - parent::observe(\App::make('App\Modules\Acl\ModelObservers\AclUserObserver')); |
|
| 70 | - } |
|
| 66 | + public static function boot() |
|
| 67 | + { |
|
| 68 | + parent::boot(); |
|
| 69 | + parent::observe(\App::make('App\Modules\Acl\ModelObservers\AclUserObserver')); |
|
| 70 | + } |
|
| 71 | 71 | } |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | |
| 6 | 6 | class Report extends Model{ |
| 7 | 7 | |
| 8 | - use SoftDeletes; |
|
| 8 | + use SoftDeletes; |
|
| 9 | 9 | protected $table = 'reports'; |
| 10 | 10 | protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
| 11 | 11 | protected $hidden = ['deleted_at']; |
@@ -13,23 +13,23 @@ discard block |
||
| 13 | 13 | protected $fillable = ['report_name', 'view_name']; |
| 14 | 14 | |
| 15 | 15 | public function getCreatedAtAttribute($value) |
| 16 | - { |
|
| 17 | - return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 18 | - } |
|
| 16 | + { |
|
| 17 | + return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | - public function getUpdatedAtAttribute($value) |
|
| 21 | - { |
|
| 22 | - return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 23 | - } |
|
| 20 | + public function getUpdatedAtAttribute($value) |
|
| 21 | + { |
|
| 22 | + return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - public function getDeletedAtAttribute($value) |
|
| 26 | - { |
|
| 27 | - return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 28 | - } |
|
| 25 | + public function getDeletedAtAttribute($value) |
|
| 26 | + { |
|
| 27 | + return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - public static function boot() |
|
| 31 | - { |
|
| 32 | - parent::boot(); |
|
| 33 | - parent::observe(\App::make('App\Modules\Reporting\ModelObservers\ReprotObserver')); |
|
| 34 | - } |
|
| 30 | + public static function boot() |
|
| 31 | + { |
|
| 32 | + parent::boot(); |
|
| 33 | + parent::observe(\App::make('App\Modules\Reporting\ModelObservers\ReprotObserver')); |
|
| 34 | + } |
|
| 35 | 35 | } |
@@ -5,44 +5,44 @@ |
||
| 5 | 5 | */ |
| 6 | 6 | class ReprotObserver { |
| 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 | - // |
|
| 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 | - } |
|
| 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 | + // |
|
| 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 | 47 | |
| 48 | 48 | } |
| 49 | 49 | \ No newline at end of file |
@@ -5,61 +5,61 @@ |
||
| 5 | 5 | */ |
| 6 | 6 | class SettingsObserver { |
| 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 | - /** |
|
| 19 | - * Prevent the creating of the settings. |
|
| 20 | - * |
|
| 21 | - * @param object $model the model beign created. |
|
| 22 | - * @return void |
|
| 23 | - */ |
|
| 24 | - public function creating($model) |
|
| 25 | - { |
|
| 26 | - $error = \ErrorHandler::cannotCreateSetting(); |
|
| 27 | - abort($error['status'], $error['message']); |
|
| 28 | - } |
|
| 18 | + /** |
|
| 19 | + * Prevent the creating of the settings. |
|
| 20 | + * |
|
| 21 | + * @param object $model the model beign created. |
|
| 22 | + * @return void |
|
| 23 | + */ |
|
| 24 | + public function creating($model) |
|
| 25 | + { |
|
| 26 | + $error = \ErrorHandler::cannotCreateSetting(); |
|
| 27 | + abort($error['status'], $error['message']); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - public function created($model) |
|
| 31 | - { |
|
| 32 | - // |
|
| 33 | - } |
|
| 30 | + public function created($model) |
|
| 31 | + { |
|
| 32 | + // |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * Prevent updating of the setting key. |
|
| 37 | - * |
|
| 38 | - * @param object $model the model beign updated. |
|
| 39 | - * @return void |
|
| 40 | - */ |
|
| 41 | - public function updating($model) |
|
| 42 | - { |
|
| 43 | - if ($model->original['key'] !== $model->key) |
|
| 44 | - { |
|
| 45 | - $error = \ErrorHandler::cannotUpdateSettingKey(); |
|
| 46 | - abort($error['status'], $error['message']); |
|
| 47 | - } |
|
| 48 | - } |
|
| 35 | + /** |
|
| 36 | + * Prevent updating of the setting key. |
|
| 37 | + * |
|
| 38 | + * @param object $model the model beign updated. |
|
| 39 | + * @return void |
|
| 40 | + */ |
|
| 41 | + public function updating($model) |
|
| 42 | + { |
|
| 43 | + if ($model->original['key'] !== $model->key) |
|
| 44 | + { |
|
| 45 | + $error = \ErrorHandler::cannotUpdateSettingKey(); |
|
| 46 | + abort($error['status'], $error['message']); |
|
| 47 | + } |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - public function updated($model) |
|
| 51 | - { |
|
| 52 | - // |
|
| 53 | - } |
|
| 50 | + public function updated($model) |
|
| 51 | + { |
|
| 52 | + // |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - public function deleting($model) |
|
| 56 | - { |
|
| 57 | - // |
|
| 58 | - } |
|
| 55 | + public function deleting($model) |
|
| 56 | + { |
|
| 57 | + // |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - public function deleted($model) |
|
| 61 | - { |
|
| 62 | - // |
|
| 63 | - } |
|
| 60 | + public function deleted($model) |
|
| 61 | + { |
|
| 62 | + // |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | 65 | } |
| 66 | 66 | \ No newline at end of file |
@@ -5,44 +5,44 @@ |
||
| 5 | 5 | */ |
| 6 | 6 | class LogObserver { |
| 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 | - // |
|
| 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 | - } |
|
| 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 | + // |
|
| 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 | 47 | |
| 48 | 48 | } |
| 49 | 49 | \ No newline at end of file |
@@ -5,31 +5,31 @@ |
||
| 5 | 5 | |
| 6 | 6 | class Settings extends Model{ |
| 7 | 7 | |
| 8 | - use SoftDeletes; |
|
| 9 | - protected $table = 'settings'; |
|
| 10 | - protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
| 11 | - protected $hidden = ['deleted_at']; |
|
| 12 | - protected $guarded = ['id', 'key']; |
|
| 13 | - protected $fillable = ['name','value']; |
|
| 8 | + use SoftDeletes; |
|
| 9 | + protected $table = 'settings'; |
|
| 10 | + protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
| 11 | + protected $hidden = ['deleted_at']; |
|
| 12 | + protected $guarded = ['id', 'key']; |
|
| 13 | + protected $fillable = ['name','value']; |
|
| 14 | 14 | |
| 15 | - public function getCreatedAtAttribute($value) |
|
| 16 | - { |
|
| 17 | - return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 18 | - } |
|
| 15 | + public function getCreatedAtAttribute($value) |
|
| 16 | + { |
|
| 17 | + return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | - public function getUpdatedAtAttribute($value) |
|
| 21 | - { |
|
| 22 | - return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 23 | - } |
|
| 20 | + public function getUpdatedAtAttribute($value) |
|
| 21 | + { |
|
| 22 | + return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - public function getDeletedAtAttribute($value) |
|
| 26 | - { |
|
| 27 | - return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 28 | - } |
|
| 25 | + public function getDeletedAtAttribute($value) |
|
| 26 | + { |
|
| 27 | + return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - public static function boot() |
|
| 31 | - { |
|
| 32 | - parent::boot(); |
|
| 33 | - parent::observe(\App::make('App\Modules\Core\ModelObservers\SettingsObserver')); |
|
| 34 | - } |
|
| 30 | + public static function boot() |
|
| 31 | + { |
|
| 32 | + parent::boot(); |
|
| 33 | + parent::observe(\App::make('App\Modules\Core\ModelObservers\SettingsObserver')); |
|
| 34 | + } |
|
| 35 | 35 | } |
@@ -5,41 +5,41 @@ |
||
| 5 | 5 | |
| 6 | 6 | class Log extends Model{ |
| 7 | 7 | |
| 8 | - use SoftDeletes; |
|
| 9 | - protected $table = 'logs'; |
|
| 10 | - protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
| 11 | - protected $hidden = ['deleted_at', 'item_type']; |
|
| 12 | - protected $guarded = ['id']; |
|
| 13 | - protected $fillable = ['action', 'item_name', 'item_type', 'item_id', 'user_id']; |
|
| 14 | - |
|
| 15 | - public function getCreatedAtAttribute($value) |
|
| 16 | - { |
|
| 17 | - return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 18 | - } |
|
| 19 | - |
|
| 20 | - public function getUpdatedAtAttribute($value) |
|
| 21 | - { |
|
| 22 | - return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 23 | - } |
|
| 24 | - |
|
| 25 | - public function getDeletedAtAttribute($value) |
|
| 26 | - { |
|
| 27 | - return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 28 | - } |
|
| 8 | + use SoftDeletes; |
|
| 9 | + protected $table = 'logs'; |
|
| 10 | + protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
| 11 | + protected $hidden = ['deleted_at', 'item_type']; |
|
| 12 | + protected $guarded = ['id']; |
|
| 13 | + protected $fillable = ['action', 'item_name', 'item_type', 'item_id', 'user_id']; |
|
| 14 | + |
|
| 15 | + public function getCreatedAtAttribute($value) |
|
| 16 | + { |
|
| 17 | + return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 18 | + } |
|
| 19 | + |
|
| 20 | + public function getUpdatedAtAttribute($value) |
|
| 21 | + { |
|
| 22 | + return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 23 | + } |
|
| 24 | + |
|
| 25 | + public function getDeletedAtAttribute($value) |
|
| 26 | + { |
|
| 27 | + return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - public function user() |
|
| 31 | - { |
|
| 32 | - return $this->belongsTo('App\Modules\Acl\AclUser'); |
|
| 33 | - } |
|
| 34 | - |
|
| 35 | - public function item() |
|
| 36 | - { |
|
| 37 | - return $this->morphTo(); |
|
| 38 | - } |
|
| 39 | - |
|
| 40 | - public static function boot() |
|
| 41 | - { |
|
| 42 | - parent::boot(); |
|
| 43 | - parent::observe(\App::make('App\Modules\Core\ModelObservers\LogObserver')); |
|
| 44 | - } |
|
| 30 | + public function user() |
|
| 31 | + { |
|
| 32 | + return $this->belongsTo('App\Modules\Acl\AclUser'); |
|
| 33 | + } |
|
| 34 | + |
|
| 35 | + public function item() |
|
| 36 | + { |
|
| 37 | + return $this->morphTo(); |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + public static function boot() |
|
| 41 | + { |
|
| 42 | + parent::boot(); |
|
| 43 | + parent::observe(\App::make('App\Modules\Core\ModelObservers\LogObserver')); |
|
| 44 | + } |
|
| 45 | 45 | } |
@@ -5,51 +5,51 @@ |
||
| 5 | 5 | */ |
| 6 | 6 | class AclUserObserver { |
| 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 | - // |
|
| 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 | - /** |
|
| 39 | - * Soft delete the associated groups and logs to the deleted user. |
|
| 40 | - * |
|
| 41 | - * @param object $model the delted model. |
|
| 42 | - * @return void |
|
| 43 | - */ |
|
| 44 | - public function deleting($model) |
|
| 45 | - { |
|
| 46 | - \DB::table('users_groups')->where('user_id', $model->id)->update(array('deleted_at' => \DB::raw('NOW()'))); |
|
| 47 | - $model->logs()->delete(); |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - public function deleted($model) |
|
| 51 | - { |
|
| 52 | - // |
|
| 53 | - } |
|
| 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 | + // |
|
| 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 | + /** |
|
| 39 | + * Soft delete the associated groups and logs to the deleted user. |
|
| 40 | + * |
|
| 41 | + * @param object $model the delted model. |
|
| 42 | + * @return void |
|
| 43 | + */ |
|
| 44 | + public function deleting($model) |
|
| 45 | + { |
|
| 46 | + \DB::table('users_groups')->where('user_id', $model->id)->update(array('deleted_at' => \DB::raw('NOW()'))); |
|
| 47 | + $model->logs()->delete(); |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + public function deleted($model) |
|
| 51 | + { |
|
| 52 | + // |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | 55 | } |
| 56 | 56 | \ No newline at end of file |
@@ -5,50 +5,50 @@ |
||
| 5 | 5 | */ |
| 6 | 6 | class AclGroupObserver { |
| 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 | - // |
|
| 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 | - /** |
|
| 39 | - * Soft delete the associated permissions to the deleted group. |
|
| 40 | - * |
|
| 41 | - * @param object $model the delted model. |
|
| 42 | - * @return void |
|
| 43 | - */ |
|
| 44 | - public function deleting($model) |
|
| 45 | - { |
|
| 46 | - \DB::table('groups_permissions')->where('group_id', $model->id)->update(array('deleted_at' => \DB::raw('NOW()'))); |
|
| 47 | - } |
|
| 48 | - |
|
| 49 | - public function deleted($model) |
|
| 50 | - { |
|
| 51 | - // |
|
| 52 | - } |
|
| 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 | + // |
|
| 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 | + /** |
|
| 39 | + * Soft delete the associated permissions to the deleted group. |
|
| 40 | + * |
|
| 41 | + * @param object $model the delted model. |
|
| 42 | + * @return void |
|
| 43 | + */ |
|
| 44 | + public function deleting($model) |
|
| 45 | + { |
|
| 46 | + \DB::table('groups_permissions')->where('group_id', $model->id)->update(array('deleted_at' => \DB::raw('NOW()'))); |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + public function deleted($model) |
|
| 50 | + { |
|
| 51 | + // |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | 54 | } |
| 55 | 55 | \ No newline at end of file |