Work on registration of existing systems to users

This commit is contained in:
Deon George
2022-03-14 22:28:54 +11:00
parent d68307461e
commit 8072f7c5a9
19 changed files with 553 additions and 56 deletions

View File

@@ -21,7 +21,7 @@ class SystemRegister extends FormRequest
{
$this->so = System::findOrNew($request->system_id);
return Gate::allows($this->so->exists ? 'update' : 'create',$this->so);
return Gate::allows($this->so->users->count() ? 'update' : 'register',$this->so);
}
/**
@@ -31,7 +31,7 @@ class SystemRegister extends FormRequest
*/
public function rules(Request $request)
{
if (! $request->isMethod('post'))
if ((! $request->isMethod('post')) || ($request->action == 'register'))
return [];
if ((! $this->so->exists) && ($request->action == 'create')) {