forked from miguel456/rbrecruiter
Prevent empty form creation
This commit is contained in:
parent
0930c29b9a
commit
6cc99d2ebe
|
@ -33,6 +33,14 @@ class FormController extends Controller
|
|||
$this->authorize('create', Form::class);
|
||||
$fields = $request->all();
|
||||
|
||||
if (count($fields) == 2)
|
||||
{
|
||||
// form is probably empty, since forms with fields will alawys have more than 2 items
|
||||
|
||||
$request->session()->flash('error', 'Sorry, but you may not create empty forms.');
|
||||
return redirect()->to(route('showForms'));
|
||||
}
|
||||
|
||||
$contextValidation = ContextAwareValidator::getValidator($fields, true, true);
|
||||
|
||||
if (!$contextValidation->get('validator')->fails())
|
||||
|
|
Loading…
Reference in New Issue