Move mailer details into a separate table
This commit is contained in:
@@ -276,11 +276,17 @@ class SystemController extends Controller
|
||||
$this->authorize('update',$o);
|
||||
|
||||
if ($request->post()) {
|
||||
foreach (['name','location','sysop','hold','phone','address','port','active','method','notes','mailer_type','mailer_address','mailer_port','zt_id','pkt_type'] as $key)
|
||||
foreach (['name','location','sysop','hold','phone','address','port','active','method','notes','zt_id','pkt_type'] as $key)
|
||||
$o->{$key} = $request->post($key);
|
||||
|
||||
$o->save();
|
||||
|
||||
$mailers = collect($request->post('mailer_details'))
|
||||
->filter(function($item) { return $item['port']; })
|
||||
->transform(function($item) { $item['active'] = Arr::get($item,'active',FALSE); return $item; });
|
||||
|
||||
$o->mailers()->sync($mailers);
|
||||
|
||||
return redirect()->action([self::class,'home']);
|
||||
}
|
||||
|
||||
@@ -687,7 +693,7 @@ class SystemController extends Controller
|
||||
if (! $o->exist) {
|
||||
$o->sysop = Auth::user()->name;
|
||||
|
||||
foreach (['name','zt_id','location','mailer_type','mailer_address','mailer_port','phone','method','address','port'] as $item)
|
||||
foreach (['name','zt_id','location','phone','method','address','port'] as $item)
|
||||
if ($request->{$item})
|
||||
$o->{$item} = $request->{$item};
|
||||
|
||||
|
@@ -56,9 +56,8 @@ class SystemRegister extends FormRequest
|
||||
'address' => 'nullable|regex:/^(?!:\/\/)(?=.{1,255}$)((.{1,63}\.){1,127}(?![0-9]*$)[a-z0-9-]+\.?)$/i',
|
||||
'port' => 'nullable|digits_between:2,5',
|
||||
'method' => 'nullable|numeric',
|
||||
'mailer_type' => 'nullable|numeric',
|
||||
'mailer_address' => 'nullable|regex:/^(?!:\/\/)(?=.{1,255}$)((.{1,63}\.){1,127}(?![0-9]*$)[a-z0-9-]+\.?)$/i',
|
||||
'mailer_port' => 'nullable|digits_between:2,5',
|
||||
'mailer_details.*' => 'nullable|array',
|
||||
'mailer_details.*.port' => 'nullable|digits_between:2,5',
|
||||
'zt_id' => 'nullable|size:10|regex:/^([A-Fa-f0-9]){10}$/|unique:systems,zt_id,'.($this->so->exists ? $this->so->id : 0),
|
||||
'pkt_type' => ['required',Rule::in(array_keys(Packet::PACKET_TYPES))],
|
||||
] : [],
|
||||
|
Reference in New Issue
Block a user