Attachment system some file

This commit is contained in:
cuneytsenturk
2017-12-28 17:20:16 +03:00
parent 411de05efd
commit 97afc50cfa
16 changed files with 420 additions and 84 deletions

View File

@ -128,16 +128,17 @@ class Bills extends Controller
$request['amount'] = 0;
// Upload attachment
$attachment_path = $this->getUploadedFilePath($request->file('attachment'), 'bills');
if ($attachment_path) {
$request['attachment'] = $attachment_path;
}
$bill = Bill::create($request->input());
// Upload attachment
if ($request->file('attachment')) {
$media = $this->getMedia($request->file('attachment'), 'revenues');
$invoice->attachMedia($media, 'attachment');
}
$taxes = [];
$tax_total = 0;
$sub_total = 0;
@ -357,13 +358,6 @@ class Bills extends Controller
$request['amount'] = 0;
// Upload attachment
$attachment_path = $this->getUploadedFilePath($request->file('attachment'), 'bills');
if ($attachment_path) {
$request['attachment'] = $attachment_path;
}
$taxes = [];
$tax_total = 0;
$sub_total = 0;
@ -460,6 +454,13 @@ class Bills extends Controller
$bill->update($request->input());
// Upload attachment
if ($request->file('attachment')) {
$media = $this->getMedia($request->file('attachment'), 'bills');
$bill->syncMedia($media, 'attachment');
}
// Added bill total total
$bill_total = [
'company_id' => $request['company_id'],
@ -594,15 +595,15 @@ class Bills extends Controller
$request['currency_code'] = $currency->code;
$request['currency_rate'] = $currency->rate;
// Upload attachment
$attachment_path = $this->getUploadedFilePath($request->file('attachment'), 'revenues');
if ($attachment_path) {
$request['attachment'] = $attachment_path;
}
$bill = Bill::find($request['bill_id']);
// Upload attachment
if ($request->file('attachment')) {
$media = $this->getMedia($request->file('attachment'), 'payments');
$bill->attachMedia($media, 'attachment');
}
$total_amount = $bill->amount;
$amount = (double) $request['amount'];