Attachment system some file
This commit is contained in:
@ -137,16 +137,17 @@ class Invoices extends Controller
|
||||
|
||||
$request['amount'] = 0;
|
||||
|
||||
// Upload attachment
|
||||
$attachment_path = $this->getUploadedFilePath($request->file('attachment'), 'invoices');
|
||||
|
||||
if ($attachment_path) {
|
||||
$request['attachment'] = $attachment_path;
|
||||
}
|
||||
|
||||
$invoice = Invoice::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;
|
||||
|
||||
@ -349,13 +350,6 @@ class Invoices extends Controller
|
||||
$request['currency_code'] = $currency->code;
|
||||
$request['currency_rate'] = $currency->rate;
|
||||
|
||||
// Upload attachment
|
||||
$attachment_path = $this->getUploadedFilePath($request->file('attachment'), 'invoices');
|
||||
|
||||
if ($attachment_path) {
|
||||
$request['attachment'] = $attachment_path;
|
||||
}
|
||||
|
||||
$taxes = [];
|
||||
$tax_total = 0;
|
||||
$sub_total = 0;
|
||||
@ -418,6 +412,13 @@ class Invoices extends Controller
|
||||
|
||||
$invoice->update($request->input());
|
||||
|
||||
// Upload attachment
|
||||
if ($request->file('attachment')) {
|
||||
$media = $this->getMedia($request->file('attachment'), 'invoices');
|
||||
|
||||
$invoice->syncMedia($media, 'attachment');
|
||||
}
|
||||
|
||||
// Delete previous invoice totals
|
||||
InvoiceTotal::where('invoice_id', $invoice->id)->delete();
|
||||
|
||||
@ -624,13 +625,6 @@ class Invoices extends Controller
|
||||
$request['currency_code'] = $currency->code;
|
||||
$request['currency_rate'] = $currency->rate;
|
||||
|
||||
// Upload attachment
|
||||
$attachment_path = $this->getUploadedFilePath($request->file('attachment'), 'invoices');
|
||||
|
||||
if ($attachment_path) {
|
||||
$request['attachment'] = $attachment_path;
|
||||
}
|
||||
|
||||
$invoice = Invoice::find($request['invoice_id']);
|
||||
|
||||
$total_amount = $invoice->amount;
|
||||
@ -669,6 +663,13 @@ class Invoices extends Controller
|
||||
|
||||
$invoice_payment = InvoicePayment::create($request->input());
|
||||
|
||||
// Upload attachment
|
||||
if ($request->file('attachment')) {
|
||||
$media = $this->getMedia($request->file('attachment'), 'invoices');
|
||||
|
||||
$invoice_payment->attachMedia($media, 'attachment');
|
||||
}
|
||||
|
||||
$request['status_code'] = $invoice->invoice_status_code;
|
||||
$request['notify'] = 0;
|
||||
|
||||
|
@ -79,13 +79,14 @@ class Revenues 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;
|
||||
}
|
||||
$revenue = Revenue::create($request->input());
|
||||
|
||||
Revenue::create($request->input());
|
||||
// Upload attachment
|
||||
if ($request->file('attachment')) {
|
||||
$media = $this->getMedia($request->file('attachment'), 'revenues');
|
||||
|
||||
$revenue->syncMedia($media, 'attachment');
|
||||
}
|
||||
|
||||
$message = trans('messages.success.added', ['type' => trans_choice('general.revenues', 1)]);
|
||||
|
||||
@ -177,14 +178,15 @@ class Revenues 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;
|
||||
}
|
||||
|
||||
$revenue->update($request->input());
|
||||
|
||||
// Upload attachment
|
||||
if ($request->file('attachment')) {
|
||||
$media = $this->getMedia($request->file('attachment'), 'revenues');
|
||||
|
||||
$revenue->syncMedia($media, 'attachment');
|
||||
}
|
||||
|
||||
$message = trans('messages.success.updated', ['type' => trans_choice('general.revenues', 1)]);
|
||||
|
||||
flash($message)->success();
|
||||
|
Reference in New Issue
Block a user