FeaturesIntegrations
1 month ago
GetSettingsController.php
1 month ago
UpdateSettingsCategoriesController.php
1 month ago
UpdateSettingsController.php
2 weeks ago
UpdateSettingsCategoriesController.php
44 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AmeliaBooking\Application\Controller\Settings; |
| 4 | |
| 5 | use AmeliaBooking\Application\Commands\Settings\UpdateSettingsCategoriesCommand; |
| 6 | use AmeliaBooking\Application\Controller\Controller; |
| 7 | use RuntimeException; |
| 8 | use AmeliaVendor\Psr\Http\Message\ServerRequestInterface as Request; |
| 9 | |
| 10 | /** |
| 11 | * Class UpdateSettingsCategoriesController |
| 12 | * |
| 13 | * @package AmeliaBooking\Application\Controller\Settings |
| 14 | */ |
| 15 | class UpdateSettingsCategoriesController extends Controller |
| 16 | { |
| 17 | /** |
| 18 | * Fields for settings category that can be received from front-end |
| 19 | * |
| 20 | * @var array |
| 21 | */ |
| 22 | protected $allowedFields = [ |
| 23 | 'categories', |
| 24 | ]; |
| 25 | |
| 26 | /** |
| 27 | * @param Request $request |
| 28 | * @param $args |
| 29 | * |
| 30 | * @return UpdateSettingsCategoriesCommand |
| 31 | * @throws RuntimeException |
| 32 | */ |
| 33 | protected function instantiateCommand(Request $request, $args) |
| 34 | { |
| 35 | $command = new UpdateSettingsCategoriesCommand($args); |
| 36 | |
| 37 | $requestBody = $request->getParsedBody(); |
| 38 | |
| 39 | $this->setCommandFields($command, $requestBody); |
| 40 | |
| 41 | return $command; |
| 42 | } |
| 43 | } |
| 44 |