refactor: code style changes
Signed-off-by: miguel456 <me@nogueira.codes>
This commit is contained in:
@@ -25,14 +25,14 @@ use App\Exceptions\EmptyFormException;
|
||||
use App\Exceptions\FormHasConstraintsException;
|
||||
use App\Form;
|
||||
use App\Services\FormManagementService;
|
||||
use ContextAwareValidator;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class FormController extends Controller
|
||||
{
|
||||
private $formService;
|
||||
|
||||
public function __construct(FormManagementService $formService) {
|
||||
public function __construct(FormManagementService $formService)
|
||||
{
|
||||
$this->formService = $formService;
|
||||
}
|
||||
|
||||
@@ -56,17 +56,14 @@ class FormController extends Controller
|
||||
{
|
||||
try {
|
||||
$form = $this->formService->addForm($request->all());
|
||||
}
|
||||
catch (EmptyFormException $ex)
|
||||
{
|
||||
} catch (EmptyFormException $ex) {
|
||||
return redirect()
|
||||
->back()
|
||||
->with('exception', $ex->getMessage());
|
||||
}
|
||||
|
||||
// Form is boolean or array
|
||||
if ($form)
|
||||
{
|
||||
if ($form) {
|
||||
return redirect()
|
||||
->back()
|
||||
->with('success', __('Form created!'));
|
||||
@@ -81,18 +78,15 @@ class FormController extends Controller
|
||||
{
|
||||
$this->authorize('delete', $form);
|
||||
try {
|
||||
|
||||
$this->formService->deleteForm($form);
|
||||
|
||||
return redirect()
|
||||
->back()
|
||||
->with('success', __('Form deleted successfuly'));
|
||||
|
||||
} catch (FormHasConstraintsException $ex) {
|
||||
|
||||
return redirect()
|
||||
->back()
|
||||
->with('error', $ex->getMessage());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user