芝麻web文件管理V1.00
编辑当前文件:/home/pulsehostuk9/public_html/invoicer.pulsehost.co.uk/app/Http/Requests/CustomerRequest.php
[ 'required', ], 'email' => [ 'email', 'nullable', Rule::unique('customers')->where('company_id', $this->header('company')), ], 'password' => [ 'nullable', ], 'phone' => [ 'nullable', ], 'company_name' => [ 'nullable', ], 'contact_name' => [ 'nullable', ], 'website' => [ 'nullable', ], 'prefix' => [ 'nullable', ], 'enable_portal' => [ 'boolean', ], 'currency_id' => [ 'nullable', ], 'billing.name' => [ 'nullable', ], 'billing.address_street_1' => [ 'nullable', ], 'billing.address_street_2' => [ 'nullable', ], 'billing.city' => [ 'nullable', ], 'billing.state' => [ 'nullable', ], 'billing.country_id' => [ 'nullable', ], 'billing.zip' => [ 'nullable', ], 'billing.phone' => [ 'nullable', ], 'billing.fax' => [ 'nullable', ], 'shipping.name' => [ 'nullable', ], 'shipping.address_street_1' => [ 'nullable', ], 'shipping.address_street_2' => [ 'nullable', ], 'shipping.city' => [ 'nullable', ], 'shipping.state' => [ 'nullable', ], 'shipping.country_id' => [ 'nullable', ], 'shipping.zip' => [ 'nullable', ], 'shipping.phone' => [ 'nullable', ], 'shipping.fax' => [ 'nullable', ], ]; if ($this->isMethod('PUT') && $this->email != null) { $rules['email'] = [ 'email', 'nullable', Rule::unique('customers')->where('company_id', $this->header('company'))->ignore($this->route('customer')->id), ]; } return $rules; } public function getCustomerPayload() { return collect($this->validated()) ->only([ 'name', 'email', 'currency_id', 'password', 'phone', 'prefix', 'company_name', 'contact_name', 'website', 'enable_portal', 'estimate_prefix', 'payment_prefix', 'invoice_prefix', ]) ->merge([ 'creator_id' => $this->user()->id, 'company_id' => $this->header('company'), ]) ->toArray(); } public function getShippingAddress() { return collect($this->shipping) ->merge([ 'type' => Address::SHIPPING_TYPE, ]) ->toArray(); } public function getBillingAddress() { return collect($this->billing) ->merge([ 'type' => Address::BILLING_TYPE, ]) ->toArray(); } public function hasAddress(array $address) { $data = Arr::where($address, function ($value, $key) { return isset($value); }); return $data; } }