@@ -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,41 +5,41 @@ |
||
| 5 | 5 | |
| 6 | 6 | class AclGroup extends Model{ |
| 7 | 7 | |
| 8 | - use SoftDeletes; |
|
| 9 | - protected $table = 'groups'; |
|
| 10 | - protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
| 11 | - protected $hidden = ['deleted_at']; |
|
| 12 | - protected $guarded = ['id']; |
|
| 13 | - protected $fillable = ['name']; |
|
| 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 | - |
|
| 30 | - public function users() |
|
| 31 | - { |
|
| 32 | - return $this->belongsToMany('\App\Modules\Acl\AclUser','users_groups','group_id','user_id')->whereNull('users_groups.deleted_at')->withTimestamps(); |
|
| 33 | - } |
|
| 34 | - |
|
| 35 | - public function permissions() |
|
| 36 | - { |
|
| 37 | - return $this->belongsToMany('\App\Modules\Acl\AclPermission','groups_permissions','group_id','permission_id')->whereNull('groups_permissions.deleted_at')->withTimestamps(); |
|
| 38 | - } |
|
| 39 | - |
|
| 40 | - public static function boot() |
|
| 41 | - { |
|
| 42 | - parent::boot(); |
|
| 43 | - parent::observe(\App::make('App\Modules\Acl\ModelObservers\AclGroupObserver')); |
|
| 44 | - } |
|
| 8 | + use SoftDeletes; |
|
| 9 | + protected $table = 'groups'; |
|
| 10 | + protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
| 11 | + protected $hidden = ['deleted_at']; |
|
| 12 | + protected $guarded = ['id']; |
|
| 13 | + protected $fillable = ['name']; |
|
| 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 | + |
|
| 30 | + public function users() |
|
| 31 | + { |
|
| 32 | + return $this->belongsToMany('\App\Modules\Acl\AclUser','users_groups','group_id','user_id')->whereNull('users_groups.deleted_at')->withTimestamps(); |
|
| 33 | + } |
|
| 34 | + |
|
| 35 | + public function permissions() |
|
| 36 | + { |
|
| 37 | + return $this->belongsToMany('\App\Modules\Acl\AclPermission','groups_permissions','group_id','permission_id')->whereNull('groups_permissions.deleted_at')->withTimestamps(); |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + public static function boot() |
|
| 41 | + { |
|
| 42 | + parent::boot(); |
|
| 43 | + parent::observe(\App::make('App\Modules\Acl\ModelObservers\AclGroupObserver')); |
|
| 44 | + } |
|
| 45 | 45 | } |
@@ -5,51 +5,51 @@ |
||
| 5 | 5 | */ |
| 6 | 6 | class NotificationObserver { |
| 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 | - /** |
|
| 24 | - * Publish the created notification to the redis server |
|
| 25 | - * to broadcast it to all listners. |
|
| 26 | - * |
|
| 27 | - * @param object $model the model beign created. |
|
| 28 | - * @return void |
|
| 29 | - */ |
|
| 30 | - public function created($model) |
|
| 31 | - { |
|
| 32 | - \Redis::publish('notification', json_encode($model->toArray())); |
|
| 33 | - } |
|
| 34 | - |
|
| 35 | - public function updating($model) |
|
| 36 | - { |
|
| 37 | - // |
|
| 38 | - } |
|
| 39 | - |
|
| 40 | - public function updated($model) |
|
| 41 | - { |
|
| 42 | - // |
|
| 43 | - } |
|
| 44 | - |
|
| 45 | - public function deleting($model) |
|
| 46 | - { |
|
| 47 | - // |
|
| 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 | + /** |
|
| 24 | + * Publish the created notification to the redis server |
|
| 25 | + * to broadcast it to all listners. |
|
| 26 | + * |
|
| 27 | + * @param object $model the model beign created. |
|
| 28 | + * @return void |
|
| 29 | + */ |
|
| 30 | + public function created($model) |
|
| 31 | + { |
|
| 32 | + \Redis::publish('notification', json_encode($model->toArray())); |
|
| 33 | + } |
|
| 34 | + |
|
| 35 | + public function updating($model) |
|
| 36 | + { |
|
| 37 | + // |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + public function updated($model) |
|
| 41 | + { |
|
| 42 | + // |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + public function deleting($model) |
|
| 46 | + { |
|
| 47 | + // |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + public function deleted($model) |
|
| 51 | + { |
|
| 52 | + // |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | 55 | } |
| 56 | 56 | \ No newline at end of file |
@@ -5,36 +5,36 @@ |
||
| 5 | 5 | |
| 6 | 6 | class Notification extends Model{ |
| 7 | 7 | |
| 8 | - use SoftDeletes; |
|
| 9 | - protected $table = 'notifications'; |
|
| 10 | - protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
| 11 | - protected $hidden = ['deleted_at', 'item_type']; |
|
| 12 | - protected $guarded = ['id']; |
|
| 13 | - protected $fillable = ['name', 'description', 'item_name', 'item_type', 'item_id', 'notified']; |
|
| 8 | + use SoftDeletes; |
|
| 9 | + protected $table = 'notifications'; |
|
| 10 | + protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
| 11 | + protected $hidden = ['deleted_at', 'item_type']; |
|
| 12 | + protected $guarded = ['id']; |
|
| 13 | + protected $fillable = ['name', 'description', 'item_name', 'item_type', 'item_id', 'notified']; |
|
| 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 function item() |
|
| 31 | - { |
|
| 32 | - return $this->morphTo(); |
|
| 33 | - } |
|
| 30 | + public function item() |
|
| 31 | + { |
|
| 32 | + return $this->morphTo(); |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - public static function boot() |
|
| 36 | - { |
|
| 37 | - parent::boot(); |
|
| 38 | - parent::observe(\App::make('App\Modules\Notifications\ModelObservers\NotificationObserver')); |
|
| 39 | - } |
|
| 35 | + public static function boot() |
|
| 36 | + { |
|
| 37 | + parent::boot(); |
|
| 38 | + parent::observe(\App::make('App\Modules\Notifications\ModelObservers\NotificationObserver')); |
|
| 39 | + } |
|
| 40 | 40 | } |
@@ -6,26 +6,26 @@ |
||
| 6 | 6 | |
| 7 | 7 | class ApiSkeletonServiceProvider extends ServiceProvider |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Perform post-registration booting of services. |
|
| 11 | - * |
|
| 12 | - * @return void |
|
| 13 | - */ |
|
| 14 | - public function boot() |
|
| 15 | - { |
|
| 16 | - $this->publishes([ |
|
| 17 | - __DIR__.'/Modules' => app_path('Modules'), |
|
| 18 | - ]); |
|
| 9 | + /** |
|
| 10 | + * Perform post-registration booting of services. |
|
| 11 | + * |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function boot() |
|
| 15 | + { |
|
| 16 | + $this->publishes([ |
|
| 17 | + __DIR__.'/Modules' => app_path('Modules'), |
|
| 18 | + ]); |
|
| 19 | 19 | |
| 20 | - } |
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * Register any package services. |
|
| 24 | - * |
|
| 25 | - * @return void |
|
| 26 | - */ |
|
| 27 | - public function register() |
|
| 28 | - { |
|
| 29 | - // |
|
| 30 | - } |
|
| 22 | + /** |
|
| 23 | + * Register any package services. |
|
| 24 | + * |
|
| 25 | + * @return void |
|
| 26 | + */ |
|
| 27 | + public function register() |
|
| 28 | + { |
|
| 29 | + // |
|
| 30 | + } |
|
| 31 | 31 | } |
| 32 | 32 | \ No newline at end of file |