![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/syn.corals.io/Corals/modules/Syndicate/Http/Requests/ |
<?php namespace Corals\Modules\Syndicate\Http\Requests; use Corals\Foundation\Http\Requests\BaseRequest; use Corals\Modules\Syndicate\Models\Warehouse; class WarehouseRequest extends BaseRequest { /** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { $this->setModel(Warehouse::class); return $this->isAuthorized(); } /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { $this->setModel(Warehouse::class); $rules = parent::rules(); if ($this->isUpdate() || $this->isStore()) { $rules = array_merge($rules, [ 'pharmacists.*.user_id' => 'sometimes|exists:users,id', 'pharmacists.*.percentage' => 'sometimes|required', 'pharmacists.*.is_responsible' => 'boolean', 'name' => 'required', 'opening_date' => 'required|date', 'area' => 'required', 'street' => 'required', 'district_code' => 'required|exists:utility_list_of_values,code', 'city_code' => 'required|exists:utility_list_of_values,code', 'phone' => 'required', ]); } if ($this->isStore()) { $rules = array_merge($rules, [ ]); } if ($this->isUpdate()) { $warehouse = $this->route('warehouse'); $rules = array_merge($rules, [ ]); } return $rules; } public function attributes() { return [ 'pharmacists.*.user_id' => trans('Syndicate::attributes.warehouse.responsible_pharmacist'), 'pharmacists.*.percentage' => trans('Syndicate::attributes.warehouse.percentage'), 'pharmacists.*.is_responsible' => trans('Syndicate::attributes.warehouse.is_responsible'), 'name' => trans('Syndicate::attributes.warehouse.name'), 'opening_date' => trans('Syndicate::attributes.warehouse.opening_date'), 'area' => trans('Syndicate::attributes.warehouse.area'), 'street' => trans('Syndicate::attributes.warehouse.street'), 'district_code' => trans('Syndicate::attributes.warehouse.district'), 'city_code' => trans('Syndicate::attributes.warehouse.city'), 'phone' => trans('Syndicate::attributes.warehouse.phone'), ]; } }