@@ -5,45 +5,45 @@ |
||
| 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 | - } |
|
| 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 static function boot() |
|
| 31 | - { |
|
| 32 | - parent::boot(); |
|
| 33 | - |
|
| 34 | - Settings::creating(function($setting) |
|
| 35 | - { |
|
| 36 | - $error = \ErrorHandler::cannotCreateSetting(); |
|
| 37 | - abort($error['status'], $error['message']); |
|
| 38 | - }); |
|
| 39 | - |
|
| 40 | - Settings::updating(function($setting) |
|
| 41 | - { |
|
| 42 | - if ($setting->original['key'] !== $setting->key) |
|
| 43 | - { |
|
| 44 | - $error = \ErrorHandler::cannotUpdateSettingKey(); |
|
| 45 | - abort($error['status'], $error['message']); |
|
| 46 | - } |
|
| 47 | - }); |
|
| 48 | - } |
|
| 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 static function boot() |
|
| 31 | + { |
|
| 32 | + parent::boot(); |
|
| 33 | + |
|
| 34 | + Settings::creating(function($setting) |
|
| 35 | + { |
|
| 36 | + $error = \ErrorHandler::cannotCreateSetting(); |
|
| 37 | + abort($error['status'], $error['message']); |
|
| 38 | + }); |
|
| 39 | + |
|
| 40 | + Settings::updating(function($setting) |
|
| 41 | + { |
|
| 42 | + if ($setting->original['key'] !== $setting->key) |
|
| 43 | + { |
|
| 44 | + $error = \ErrorHandler::cannotUpdateSettingKey(); |
|
| 45 | + abort($error['status'], $error['message']); |
|
| 46 | + } |
|
| 47 | + }); |
|
| 48 | + } |
|
| 49 | 49 | } |
@@ -3,127 +3,127 @@ |
||
| 3 | 3 | interface RepositoryInterface |
| 4 | 4 | { |
| 5 | 5 | /** |
| 6 | - * Fetch all records with relations from the storage. |
|
| 7 | - * |
|
| 8 | - * @param array $relations |
|
| 9 | - * @param array $sortBy |
|
| 10 | - * @param array $desc |
|
| 11 | - * @param array $columns |
|
| 12 | - * @return collection |
|
| 13 | - */ |
|
| 6 | + * Fetch all records with relations from the storage. |
|
| 7 | + * |
|
| 8 | + * @param array $relations |
|
| 9 | + * @param array $sortBy |
|
| 10 | + * @param array $desc |
|
| 11 | + * @param array $columns |
|
| 12 | + * @return collection |
|
| 13 | + */ |
|
| 14 | 14 | public function all($relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*')); |
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * Fetch all records with relations from storage in pages |
|
| 18 | - * that matche the given query. |
|
| 19 | - * |
|
| 20 | - * @param string $query |
|
| 21 | - * @param integer $perPage |
|
| 22 | - * @param array $relations |
|
| 23 | - * @param array $sortBy |
|
| 24 | - * @param array $desc |
|
| 25 | - * @param array $columns |
|
| 26 | - * @return collection |
|
| 27 | - */ |
|
| 28 | - public function search($query, $perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*')); |
|
| 16 | + /** |
|
| 17 | + * Fetch all records with relations from storage in pages |
|
| 18 | + * that matche the given query. |
|
| 19 | + * |
|
| 20 | + * @param string $query |
|
| 21 | + * @param integer $perPage |
|
| 22 | + * @param array $relations |
|
| 23 | + * @param array $sortBy |
|
| 24 | + * @param array $desc |
|
| 25 | + * @param array $columns |
|
| 26 | + * @return collection |
|
| 27 | + */ |
|
| 28 | + public function search($query, $perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*')); |
|
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | - * Fetch all records with relations from storage in pages. |
|
| 32 | - * |
|
| 33 | - * @param integer $perPage |
|
| 34 | - * @param array $relations |
|
| 35 | - * @param array $sortBy |
|
| 36 | - * @param array $desc |
|
| 37 | - * @param array $columns |
|
| 38 | - * @return collection |
|
| 39 | - */ |
|
| 40 | - public function paginate($perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*')); |
|
| 31 | + * Fetch all records with relations from storage in pages. |
|
| 32 | + * |
|
| 33 | + * @param integer $perPage |
|
| 34 | + * @param array $relations |
|
| 35 | + * @param array $sortBy |
|
| 36 | + * @param array $desc |
|
| 37 | + * @param array $columns |
|
| 38 | + * @return collection |
|
| 39 | + */ |
|
| 40 | + public function paginate($perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*')); |
|
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | - * Fetch all records with relations based on |
|
| 44 | - * the given condition from storage in pages. |
|
| 45 | - * |
|
| 46 | - * @param array $conditions array of conditions |
|
| 47 | - * @param integer $perPage |
|
| 48 | - * @param array $relations |
|
| 49 | - * @param array $sortBy |
|
| 50 | - * @param array $desc |
|
| 51 | - * @param array $columns |
|
| 52 | - * @return collection |
|
| 53 | - */ |
|
| 54 | - public function paginateBy($conditions, $perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*')); |
|
| 43 | + * Fetch all records with relations based on |
|
| 44 | + * the given condition from storage in pages. |
|
| 45 | + * |
|
| 46 | + * @param array $conditions array of conditions |
|
| 47 | + * @param integer $perPage |
|
| 48 | + * @param array $relations |
|
| 49 | + * @param array $sortBy |
|
| 50 | + * @param array $desc |
|
| 51 | + * @param array $columns |
|
| 52 | + * @return collection |
|
| 53 | + */ |
|
| 54 | + public function paginateBy($conditions, $perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*')); |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * Save the given model/models to the storage. |
|
| 58 | - * |
|
| 59 | - * @param array $data |
|
| 60 | - * @param boolean $saveLog |
|
| 61 | - * @return object |
|
| 62 | - */ |
|
| 63 | - public function save(array $data, $saveLog = true); |
|
| 56 | + /** |
|
| 57 | + * Save the given model/models to the storage. |
|
| 58 | + * |
|
| 59 | + * @param array $data |
|
| 60 | + * @param boolean $saveLog |
|
| 61 | + * @return object |
|
| 62 | + */ |
|
| 63 | + public function save(array $data, $saveLog = true); |
|
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * Insert multiple records to the storage. |
|
| 67 | - * |
|
| 68 | - * @param array $data |
|
| 69 | - * @return object |
|
| 70 | - */ |
|
| 71 | - public function saveMany(array $data); |
|
| 65 | + /** |
|
| 66 | + * Insert multiple records to the storage. |
|
| 67 | + * |
|
| 68 | + * @param array $data |
|
| 69 | + * @return object |
|
| 70 | + */ |
|
| 71 | + public function saveMany(array $data); |
|
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | - * Update record in the storage based on the given |
|
| 75 | - * condition. |
|
| 76 | - * |
|
| 77 | - * @param [type] $value condition value |
|
| 78 | - * @param array $data |
|
| 79 | - * @param string $attribute condition column name |
|
| 80 | - * @return integer affected rows |
|
| 81 | - */ |
|
| 82 | - public function update($value, array $data, $attribute = 'id'); |
|
| 74 | + * Update record in the storage based on the given |
|
| 75 | + * condition. |
|
| 76 | + * |
|
| 77 | + * @param [type] $value condition value |
|
| 78 | + * @param array $data |
|
| 79 | + * @param string $attribute condition column name |
|
| 80 | + * @return integer affected rows |
|
| 81 | + */ |
|
| 82 | + public function update($value, array $data, $attribute = 'id'); |
|
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | - * Delete record from the storage based on the given |
|
| 86 | - * condition. |
|
| 87 | - * |
|
| 88 | - * @param [type] $value condition value |
|
| 89 | - * @param string $attribute condition column name |
|
| 90 | - * @return integer affected rows |
|
| 91 | - */ |
|
| 92 | - public function delete($value, $attribute = 'id'); |
|
| 85 | + * Delete record from the storage based on the given |
|
| 86 | + * condition. |
|
| 87 | + * |
|
| 88 | + * @param [type] $value condition value |
|
| 89 | + * @param string $attribute condition column name |
|
| 90 | + * @return integer affected rows |
|
| 91 | + */ |
|
| 92 | + public function delete($value, $attribute = 'id'); |
|
| 93 | 93 | |
| 94 | 94 | /** |
| 95 | - * Fetch records from the storage based on the given |
|
| 96 | - * id. |
|
| 97 | - * |
|
| 98 | - * @param integer $id |
|
| 99 | - * @param array $relations |
|
| 100 | - * @param array $columns |
|
| 101 | - * @return object |
|
| 102 | - */ |
|
| 103 | - public function find($id, $relations = [], $columns = array('*')); |
|
| 95 | + * Fetch records from the storage based on the given |
|
| 96 | + * id. |
|
| 97 | + * |
|
| 98 | + * @param integer $id |
|
| 99 | + * @param array $relations |
|
| 100 | + * @param array $columns |
|
| 101 | + * @return object |
|
| 102 | + */ |
|
| 103 | + public function find($id, $relations = [], $columns = array('*')); |
|
| 104 | 104 | |
| 105 | 105 | /** |
| 106 | - * Fetch records from the storage based on the given |
|
| 107 | - * condition. |
|
| 108 | - * |
|
| 109 | - * @param array $conditions array of conditions |
|
| 110 | - * @param array $relations |
|
| 111 | - * @param array $sortBy |
|
| 112 | - * @param array $desc |
|
| 113 | - * @param array $columns |
|
| 114 | - * @return collection |
|
| 115 | - */ |
|
| 116 | - public function findBy($conditions, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*')); |
|
| 106 | + * Fetch records from the storage based on the given |
|
| 107 | + * condition. |
|
| 108 | + * |
|
| 109 | + * @param array $conditions array of conditions |
|
| 110 | + * @param array $relations |
|
| 111 | + * @param array $sortBy |
|
| 112 | + * @param array $desc |
|
| 113 | + * @param array $columns |
|
| 114 | + * @return collection |
|
| 115 | + */ |
|
| 116 | + public function findBy($conditions, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*')); |
|
| 117 | 117 | |
| 118 | - /** |
|
| 119 | - * Fetch the first record fro the storage based on the given |
|
| 120 | - * condition. |
|
| 121 | - * |
|
| 122 | - * @param array $conditions array of conditions |
|
| 123 | - * @param [type] $value condition value |
|
| 124 | - * @param array $relations |
|
| 125 | - * @param array $columns |
|
| 126 | - * @return object |
|
| 127 | - */ |
|
| 128 | - public function first($conditions, $relations = [], $columns = array('*')); |
|
| 118 | + /** |
|
| 119 | + * Fetch the first record fro the storage based on the given |
|
| 120 | + * condition. |
|
| 121 | + * |
|
| 122 | + * @param array $conditions array of conditions |
|
| 123 | + * @param [type] $value condition value |
|
| 124 | + * @param array $relations |
|
| 125 | + * @param array $columns |
|
| 126 | + * @return object |
|
| 127 | + */ |
|
| 128 | + public function first($conditions, $relations = [], $columns = array('*')); |
|
| 129 | 129 | } |
| 130 | 130 | \ No newline at end of file |
@@ -4,13 +4,13 @@ |
||
| 4 | 4 | { |
| 5 | 5 | /** |
| 6 | 6 | * Construct the repository class name based on |
| 7 | - * the method name called, search in the |
|
| 8 | - * given namespaces for the class and |
|
| 9 | - * return an instance. |
|
| 10 | - * |
|
| 11 | - * @param string $name the called method name |
|
| 12 | - * @param array $arguments the method arguments |
|
| 13 | - * @return object |
|
| 14 | - */ |
|
| 7 | + * the method name called, search in the |
|
| 8 | + * given namespaces for the class and |
|
| 9 | + * return an instance. |
|
| 10 | + * |
|
| 11 | + * @param string $name the called method name |
|
| 12 | + * @param array $arguments the method arguments |
|
| 13 | + * @return object |
|
| 14 | + */ |
|
| 15 | 15 | public function __call($name, $arguments); |
| 16 | 16 | } |
| 17 | 17 | \ No newline at end of file |
@@ -8,20 +8,20 @@ |
||
| 8 | 8 | |
| 9 | 9 | class SettingsController 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 = 'settings'; |
|
| 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 = 'settings'; |
|
| 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', |
|
| 25 | - 'value' => 'required|string|max:100' |
|
| 26 | - ]; |
|
| 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', |
|
| 25 | + 'value' => 'required|string|max:100' |
|
| 26 | + ]; |
|
| 27 | 27 | } |
@@ -13,13 +13,13 @@ |
||
| 13 | 13 | public function up() |
| 14 | 14 | { |
| 15 | 15 | Schema::create('settings', function (Blueprint $table) { |
| 16 | - $table->increments('id'); |
|
| 17 | - $table->string('name',100); |
|
| 18 | - $table->string('key',100)->unique(); |
|
| 19 | - $table->string('value',100); |
|
| 20 | - $table->softDeletes(); |
|
| 21 | - $table->timestamps(); |
|
| 22 | - }); |
|
| 16 | + $table->increments('id'); |
|
| 17 | + $table->string('name',100); |
|
| 18 | + $table->string('key',100)->unique(); |
|
| 19 | + $table->string('value',100); |
|
| 20 | + $table->softDeletes(); |
|
| 21 | + $table->timestamps(); |
|
| 22 | + }); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /** |
@@ -8,30 +8,30 @@ |
||
| 8 | 8 | class NotificationsController extends BaseApiController |
| 9 | 9 | { |
| 10 | 10 | /** |
| 11 | - * The name of the model that is used by the base api controller |
|
| 12 | - * to preform actions like (add, edit ... etc). |
|
| 13 | - * @var string |
|
| 14 | - */ |
|
| 15 | - protected $model = 'notifications'; |
|
| 11 | + * The name of the model that is used by the base api controller |
|
| 12 | + * to preform actions like (add, edit ... etc). |
|
| 13 | + * @var string |
|
| 14 | + */ |
|
| 15 | + protected $model = 'notifications'; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * Set the notification notified to true. |
|
| 19 | - * |
|
| 20 | - * @param integer $id |
|
| 21 | - * @return \Illuminate\Http\Response |
|
| 22 | - */ |
|
| 23 | - public function getNotified($id) |
|
| 24 | - { |
|
| 25 | - return \Response::json(\Core::notifications()->notified($id), 200); |
|
| 26 | - } |
|
| 17 | + /** |
|
| 18 | + * Set the notification notified to true. |
|
| 19 | + * |
|
| 20 | + * @param integer $id |
|
| 21 | + * @return \Illuminate\Http\Response |
|
| 22 | + */ |
|
| 23 | + public function getNotified($id) |
|
| 24 | + { |
|
| 25 | + return \Response::json(\Core::notifications()->notified($id), 200); |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Set the notification notified to all. |
|
| 30 | - * |
|
| 31 | - * @return \Illuminate\Http\Response |
|
| 32 | - */ |
|
| 33 | - public function getNotifyall() |
|
| 34 | - { |
|
| 35 | - return \Response::json(\Core::notifications()->notifyAll(), 200); |
|
| 36 | - } |
|
| 28 | + /** |
|
| 29 | + * Set the notification notified to all. |
|
| 30 | + * |
|
| 31 | + * @return \Illuminate\Http\Response |
|
| 32 | + */ |
|
| 33 | + public function getNotifyall() |
|
| 34 | + { |
|
| 35 | + return \Response::json(\Core::notifications()->notifyAll(), 200); |
|
| 36 | + } |
|
| 37 | 37 | } |
@@ -15,14 +15,14 @@ |
||
| 15 | 15 | Schema::create('notifications', function (Blueprint $table) { |
| 16 | 16 | $table->increments('id'); |
| 17 | 17 | $table->string('name',100); |
| 18 | - $table->text('description')->nullable(); |
|
| 18 | + $table->text('description')->nullable(); |
|
| 19 | 19 | $table->string('item_name',100); |
| 20 | 20 | $table->string('item_type',100); |
| 21 | 21 | $table->integer('item_id'); |
| 22 | 22 | $table->boolean('notified'); |
| 23 | 23 | $table->softDeletes(); |
| 24 | 24 | $table->timestamps(); |
| 25 | - }); |
|
| 25 | + }); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
@@ -5,40 +5,40 @@ |
||
| 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']; |
|
| 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 = '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 | + |
|
| 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 item() |
|
| 31 | - { |
|
| 32 | - return $this->morphTo(); |
|
| 33 | - } |
|
| 34 | - |
|
| 35 | - public static function boot() |
|
| 36 | - { |
|
| 37 | - parent::boot(); |
|
| 38 | - |
|
| 39 | - Notification::created(function($notification) |
|
| 40 | - { |
|
| 41 | - \Redis::publish('notification', json_encode($notification->toArray())); |
|
| 42 | - }); |
|
| 43 | - } |
|
| 30 | + public function item() |
|
| 31 | + { |
|
| 32 | + return $this->morphTo(); |
|
| 33 | + } |
|
| 34 | + |
|
| 35 | + public static function boot() |
|
| 36 | + { |
|
| 37 | + parent::boot(); |
|
| 38 | + |
|
| 39 | + Notification::created(function($notification) |
|
| 40 | + { |
|
| 41 | + \Redis::publish('notification', json_encode($notification->toArray())); |
|
| 42 | + }); |
|
| 43 | + } |
|
| 44 | 44 | } |
@@ -12,71 +12,71 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | public function up() |
| 14 | 14 | { |
| 15 | - /** |
|
| 16 | - * Delete previous permissions. |
|
| 17 | - */ |
|
| 15 | + /** |
|
| 16 | + * Delete previous permissions. |
|
| 17 | + */ |
|
| 18 | 18 | DB::table('permissions')->whereIn('model', ['reports'])->delete(); |
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | - * Insert the permissions related to this module. |
|
| 22 | - */ |
|
| 23 | - DB::table('permissions')->insert( |
|
| 24 | - [ |
|
| 25 | - /** |
|
| 26 | - * Reporting model permissions. |
|
| 27 | - */ |
|
| 28 | - [ |
|
| 29 | - 'name' => 'find', |
|
| 30 | - 'model' => 'reports', |
|
| 31 | - 'created_at' => \DB::raw('NOW()'), |
|
| 32 | - 'updated_at' => \DB::raw('NOW()') |
|
| 33 | - ], |
|
| 34 | - [ |
|
| 35 | - 'name' => 'search', |
|
| 36 | - 'model' => 'reports', |
|
| 37 | - 'created_at' => \DB::raw('NOW()'), |
|
| 38 | - 'updated_at' => \DB::raw('NOW()') |
|
| 39 | - ], |
|
| 40 | - [ |
|
| 41 | - 'name' => 'list', |
|
| 42 | - 'model' => 'reports', |
|
| 43 | - 'created_at' => \DB::raw('NOW()'), |
|
| 44 | - 'updated_at' => \DB::raw('NOW()') |
|
| 45 | - ], |
|
| 46 | - [ |
|
| 47 | - 'name' => 'findby', |
|
| 48 | - 'model' => 'reports', |
|
| 49 | - 'created_at' => \DB::raw('NOW()'), |
|
| 50 | - 'updated_at' => \DB::raw('NOW()') |
|
| 51 | - ], |
|
| 52 | - [ |
|
| 53 | - 'name' => 'first', |
|
| 54 | - 'model' => 'reports', |
|
| 55 | - 'created_at' => \DB::raw('NOW()'), |
|
| 56 | - 'updated_at' => \DB::raw('NOW()') |
|
| 57 | - ], |
|
| 58 | - [ |
|
| 59 | - 'name' => 'paginate', |
|
| 60 | - 'model' => 'reports', |
|
| 61 | - 'created_at' => \DB::raw('NOW()'), |
|
| 62 | - 'updated_at' => \DB::raw('NOW()') |
|
| 63 | - ], |
|
| 64 | - [ |
|
| 65 | - 'name' => 'paginateby', |
|
| 66 | - 'model' => 'reports', |
|
| 67 | - 'created_at' => \DB::raw('NOW()'), |
|
| 68 | - 'updated_at' => \DB::raw('NOW()') |
|
| 69 | - ], |
|
| 70 | - [ |
|
| 71 | - 'name' => 'admin_count', |
|
| 72 | - 'model' => 'reports', |
|
| 73 | - 'created_at' => \DB::raw('NOW()'), |
|
| 74 | - 'updated_at' => \DB::raw('NOW()') |
|
| 75 | - ] |
|
| 76 | - ] |
|
| 77 | - ); |
|
| 21 | + * Insert the permissions related to this module. |
|
| 22 | + */ |
|
| 23 | + DB::table('permissions')->insert( |
|
| 24 | + [ |
|
| 25 | + /** |
|
| 26 | + * Reporting model permissions. |
|
| 27 | + */ |
|
| 28 | + [ |
|
| 29 | + 'name' => 'find', |
|
| 30 | + 'model' => 'reports', |
|
| 31 | + 'created_at' => \DB::raw('NOW()'), |
|
| 32 | + 'updated_at' => \DB::raw('NOW()') |
|
| 33 | + ], |
|
| 34 | + [ |
|
| 35 | + 'name' => 'search', |
|
| 36 | + 'model' => 'reports', |
|
| 37 | + 'created_at' => \DB::raw('NOW()'), |
|
| 38 | + 'updated_at' => \DB::raw('NOW()') |
|
| 39 | + ], |
|
| 40 | + [ |
|
| 41 | + 'name' => 'list', |
|
| 42 | + 'model' => 'reports', |
|
| 43 | + 'created_at' => \DB::raw('NOW()'), |
|
| 44 | + 'updated_at' => \DB::raw('NOW()') |
|
| 45 | + ], |
|
| 46 | + [ |
|
| 47 | + 'name' => 'findby', |
|
| 48 | + 'model' => 'reports', |
|
| 49 | + 'created_at' => \DB::raw('NOW()'), |
|
| 50 | + 'updated_at' => \DB::raw('NOW()') |
|
| 51 | + ], |
|
| 52 | + [ |
|
| 53 | + 'name' => 'first', |
|
| 54 | + 'model' => 'reports', |
|
| 55 | + 'created_at' => \DB::raw('NOW()'), |
|
| 56 | + 'updated_at' => \DB::raw('NOW()') |
|
| 57 | + ], |
|
| 58 | + [ |
|
| 59 | + 'name' => 'paginate', |
|
| 60 | + 'model' => 'reports', |
|
| 61 | + 'created_at' => \DB::raw('NOW()'), |
|
| 62 | + 'updated_at' => \DB::raw('NOW()') |
|
| 63 | + ], |
|
| 64 | + [ |
|
| 65 | + 'name' => 'paginateby', |
|
| 66 | + 'model' => 'reports', |
|
| 67 | + 'created_at' => \DB::raw('NOW()'), |
|
| 68 | + 'updated_at' => \DB::raw('NOW()') |
|
| 69 | + ], |
|
| 70 | + [ |
|
| 71 | + 'name' => 'admin_count', |
|
| 72 | + 'model' => 'reports', |
|
| 73 | + 'created_at' => \DB::raw('NOW()'), |
|
| 74 | + 'updated_at' => \DB::raw('NOW()') |
|
| 75 | + ] |
|
| 76 | + ] |
|
| 77 | + ); |
|
| 78 | 78 | |
| 79 | - /** |
|
| 79 | + /** |
|
| 80 | 80 | * Assign the permissions to the admin group. |
| 81 | 81 | */ |
| 82 | 82 | $permissionIds = DB::table('permissions')->whereIn('model', ['reports'])->select('id')->lists('id'); |