isWholesaler(); } /** * Get the validation rules that apply to the request. * * @return array */ public function rules(Request $request) { // @todo these are broadband requirements - perhaps move them to the broadband class. // @todo Enhance the validation so that extra_* values are not accepted if base_* values are not included. return [ 'id' => 'required|nullable', 'offering_type' => ['required',Rule::in(Supplier::offeringTypeKeys()->toArray())], 'supplier_detail_id' => 'required|exists:supplier_details,id', 'active' => 'sometimes|accepted', 'extra_shaped' => 'sometimes|accepted', 'extra_charged' => 'sometimes|accepted', 'product_id' => 'required|string|min:2', 'product_desc' => 'required|string|min:2', 'base_cost' => 'required|numeric|min:.01', 'setup_cost' => 'nullable|numeric', 'contract_term' => 'nullable|numeric|min:1', 'metric' => 'nullable|numeric|min:1', 'speed' => 'nullable|string|max:64', 'technology' => 'nullable|string|max:255', 'offpeak_start' => 'nullable|date_format:H:i', 'offpeak_end' => 'nullable|date_format:H:i', 'base_down_peak' => 'nullable|numeric', 'base_up_peak' => 'nullable|numeric', 'base_down_offpeak' => 'nullable|numeric', 'base_up_offpeak' => 'nullable|numeric', 'extra_down_peak' => 'nullable|numeric', 'extra_up_peak' => 'nullable|numeric', 'extra_down_offpeak' => 'nullable|numeric', 'extra_up_offpeak' => 'nullable|numeric', ]; } }