<?php namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; use Illuminate\Http\Request; use Illuminate\Support\Facades\Gate; class SetupRequest extends FormRequest { public function authorize() { return Gate::allows('admin'); } public function rules(Request $request) { if (! $request->isMethod('post')) return []; return [ 'system_id' => 'required|exists:systems,id', 'binkp' => 'nullable|array', 'binkp.*' => 'nullable|numeric', 'dns' => 'nullable|array', 'dns.*' => 'nullable|numeric', 'emsi' => 'nullable|array', 'emsi.*' => 'nullable|numeric', '*_bind' => 'required|ip', '*_port' => 'required|numeric', '*_active' => 'nullable|accepted', 'options' => 'nullable|array', 'options.*' => 'nullable|numeric', ]; } }