芝麻web文件管理V1.00
编辑当前文件:/home/pulsehostuk9/public_html/invoicer.pulsehost.co.uk/app/Http/Requests/ExpenseRequest.php
header('company')); $rules = [ 'expense_date' => [ 'required', ], 'expense_category_id' => [ 'required', ], 'exchange_rate' => [ 'nullable', ], 'payment_method_id' => [ 'nullable', ], 'amount' => [ 'required', ], 'customer_id' => [ 'nullable', ], 'notes' => [ 'nullable', ], 'currency_id' => [ 'required', ], 'attachment_receipt' => [ 'nullable', 'file', 'mimes:jpg,png,pdf,doc,docx,xls,xlsx,ppt,pptx', 'max:20000', ], ]; if ($companyCurrency && $this->currency_id) { if ($companyCurrency !== $this->currency_id) { $rules['exchange_rate'] = [ 'required', ]; } } return $rules; } public function getExpensePayload() { $company_currency = CompanySetting::getSetting('currency', $this->header('company')); $current_currency = $this->currency_id; $exchange_rate = $company_currency != $current_currency ? $this->exchange_rate : 1; return collect($this->validated()) ->merge([ 'creator_id' => $this->user()->id, 'company_id' => $this->header('company'), 'exchange_rate' => $exchange_rate, 'base_amount' => $this->amount * $exchange_rate, 'currency_id' => $current_currency, ]) ->toArray(); } }