@@ -8,31 +8,31 @@ |
||
| 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 | - 'id' => 'required|exists:settings,id', |
|
| 25 | - 'value' => 'required|string' |
|
| 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 | + 'id' => 'required|exists:settings,id', |
|
| 25 | + 'value' => 'required|string' |
|
| 26 | + ]; |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Save list of settings. |
|
| 30 | - * |
|
| 31 | - * @param \Illuminate\Http\Request $request |
|
| 32 | - * @return \Illuminate\Http\Response |
|
| 33 | - */ |
|
| 34 | - public function saveMany(Request $request) |
|
| 35 | - { |
|
| 36 | - return \Response::json($this->repo->saveMany($request->all()), 200); |
|
| 37 | - } |
|
| 28 | + /** |
|
| 29 | + * Save list of settings. |
|
| 30 | + * |
|
| 31 | + * @param \Illuminate\Http\Request $request |
|
| 32 | + * @return \Illuminate\Http\Response |
|
| 33 | + */ |
|
| 34 | + public function saveMany(Request $request) |
|
| 35 | + { |
|
| 36 | + return \Response::json($this->repo->saveMany($request->all()), 200); |
|
| 37 | + } |
|
| 38 | 38 | } |
@@ -13,14 +13,14 @@ |
||
| 13 | 13 | * to preform actions like (add, edit ... etc). |
| 14 | 14 | * @var string |
| 15 | 15 | */ |
| 16 | - protected $model = 'settings'; |
|
| 16 | + protected $model = 'settings'; |
|
| 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 | 'id' => 'required|exists:settings,id', |
| 25 | 25 | 'value' => 'required|string' |
| 26 | 26 | ]; |
@@ -5,68 +5,68 @@ |
||
| 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 | - \ErrorHandler::cannotCreateSetting(); |
|
| 27 | - } |
|
| 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 | + \ErrorHandler::cannotCreateSetting(); |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - public function created($model) |
|
| 30 | - { |
|
| 31 | - // |
|
| 32 | - } |
|
| 29 | + public function created($model) |
|
| 30 | + { |
|
| 31 | + // |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * Prevent updating of the setting key. |
|
| 36 | - * |
|
| 37 | - * @param object $model the model beign updated. |
|
| 38 | - * @return void |
|
| 39 | - */ |
|
| 40 | - public function updating($model) |
|
| 41 | - { |
|
| 42 | - if ($model->getOriginal('key') !== $model->key) |
|
| 43 | - { |
|
| 44 | - \ErrorHandler::cannotUpdateSettingKey(); |
|
| 45 | - } |
|
| 46 | - } |
|
| 34 | + /** |
|
| 35 | + * Prevent updating of the setting key. |
|
| 36 | + * |
|
| 37 | + * @param object $model the model beign updated. |
|
| 38 | + * @return void |
|
| 39 | + */ |
|
| 40 | + public function updating($model) |
|
| 41 | + { |
|
| 42 | + if ($model->getOriginal('key') !== $model->key) |
|
| 43 | + { |
|
| 44 | + \ErrorHandler::cannotUpdateSettingKey(); |
|
| 45 | + } |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - public function updated($model) |
|
| 49 | - { |
|
| 50 | - // |
|
| 51 | - } |
|
| 48 | + public function updated($model) |
|
| 49 | + { |
|
| 50 | + // |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - public function deleting($model) |
|
| 54 | - { |
|
| 55 | - // |
|
| 56 | - } |
|
| 53 | + public function deleting($model) |
|
| 54 | + { |
|
| 55 | + // |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - public function deleted($model) |
|
| 59 | - { |
|
| 60 | - // |
|
| 61 | - } |
|
| 58 | + public function deleted($model) |
|
| 59 | + { |
|
| 60 | + // |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - public function restoring($model) |
|
| 64 | - { |
|
| 65 | - // |
|
| 66 | - } |
|
| 63 | + public function restoring($model) |
|
| 64 | + { |
|
| 65 | + // |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - public function restored($model) |
|
| 69 | - { |
|
| 70 | - // |
|
| 71 | - } |
|
| 68 | + public function restored($model) |
|
| 69 | + { |
|
| 70 | + // |
|
| 71 | + } |
|
| 72 | 72 | } |
| 73 | 73 | \ No newline at end of file |
@@ -14,19 +14,19 @@ |
||
| 14 | 14 | return 'App\Modules\Core\Settings'; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * Save list of settings. |
|
| 19 | - * |
|
| 20 | - * @param array $data |
|
| 21 | - * @return void |
|
| 22 | - */ |
|
| 23 | - public function saveMany(array $data) |
|
| 24 | - { |
|
| 25 | - \DB::transaction(function () use ($data) { |
|
| 26 | - foreach ($data as $key => $value) |
|
| 27 | - { |
|
| 28 | - $this->save($value); |
|
| 29 | - } |
|
| 30 | - }); |
|
| 31 | - } |
|
| 17 | + /** |
|
| 18 | + * Save list of settings. |
|
| 19 | + * |
|
| 20 | + * @param array $data |
|
| 21 | + * @return void |
|
| 22 | + */ |
|
| 23 | + public function saveMany(array $data) |
|
| 24 | + { |
|
| 25 | + \DB::transaction(function () use ($data) { |
|
| 26 | + foreach ($data as $key => $value) |
|
| 27 | + { |
|
| 28 | + $this->save($value); |
|
| 29 | + } |
|
| 30 | + }); |
|
| 31 | + } |
|
| 32 | 32 | } |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | public function saveMany(array $data) |
| 24 | 24 | { |
| 25 | - \DB::transaction(function () use ($data) { |
|
| 25 | + \DB::transaction(function() use ($data) { |
|
| 26 | 26 | foreach ($data as $key => $value) |
| 27 | 27 | { |
| 28 | 28 | $this->save($value); |