| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentForm\App\Http\Controllers; |
| 4 |
|
| 5 |
use FluentForm\Framework\Validator\ValidationException; |
| 6 |
use FluentForm\App\Services\GlobalSettings\GlobalSettingsService; |
| 7 |
|
| 8 |
class GlobalSettingsController extends Controller |
| 9 |
{ |
| 10 |
public function index(GlobalSettingsService $globalSettingsService) |
| 11 |
{ |
| 12 |
$result = $globalSettingsService->get($this->request->all()); |
| 13 |
return $this->sendSuccess($result); |
| 14 |
} |
| 15 |
|
| 16 |
public function store(GlobalSettingsService $globalSettingsService) |
| 17 |
{ |
| 18 |
try { |
| 19 |
$result = $globalSettingsService->store($this->request->all()); |
| 20 |
return $this->sendSuccess($result); |
| 21 |
} catch (ValidationException $exception) { |
| 22 |
return $this->sendError($exception->errors(), 422); |
| 23 |
} |
| 24 |
} |
| 25 |
} |
| 26 |
|