diff --git a/app/Http/Controllers/SystemController.php b/app/Http/Controllers/SystemController.php index dee2057..b3d9739 100644 --- a/app/Http/Controllers/SystemController.php +++ b/app/Http/Controllers/SystemController.php @@ -16,7 +16,7 @@ use Illuminate\Support\ViewErrorBag; use App\Classes\FTN\Message; use App\Http\Requests\{AddressMerge,AreafixRequest,SystemRegister}; use App\Jobs\AddressPoll; -use App\Models\{Address,Echoarea,Filearea,Netmail,Setup,System,SystemZone,Zone}; +use App\Models\{Address,Echoarea,Filearea,Netmail,Setup,System,Zone}; use App\Notifications\Netmails\AddressLink; use App\Rules\{FidoInteger,TwoByteInteger}; @@ -49,6 +49,10 @@ class SystemController extends Controller ->transform(function($item) { $item['active'] = Arr::get($item,'active',FALSE); return $item; }); $o->mailers()->sync($mailers); + if ($request->post('users') && array_filter($request->post('users'),function($item) { return $item; })) + $o->users()->sync($request->post('users')); + else + $o->users()->detach(); return redirect()->to('system'); } diff --git a/app/Http/Requests/SystemRegister.php b/app/Http/Requests/SystemRegister.php index 20d1007..69a5653 100644 --- a/app/Http/Requests/SystemRegister.php +++ b/app/Http/Requests/SystemRegister.php @@ -78,6 +78,7 @@ class SystemRegister extends FormRequest 'mailer_details.*.port' => 'nullable|digits_between:2,5', 'zt_id' => 'nullable|size:10|regex:/^([A-Fa-f0-9]){10}$/|unique:systems,zt_id,'.($so->exists ? $so->id : 0), 'pkt_type' => ['required',Rule::in(array_keys(Packet::PACKET_TYPES))], + 'users' => 'nullable|array|min:1|max:2', ] : [], $so->exists ? [ 'active' => 'required|boolean', diff --git a/resources/views/system/widget/form-system.blade.php b/resources/views/system/widget/form-system.blade.php index b3c1432..05d4f6c 100644 --- a/resources/views/system/widget/form-system.blade.php +++ b/resources/views/system/widget/form-system.blade.php @@ -1,155 +1,189 @@ -