Attachment system some file
This commit is contained in:
@ -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'];
|
||||
|
@ -77,13 +77,14 @@ class Payments extends Controller
|
||||
$request['currency_code'] = $currency->code;
|
||||
$request['currency_rate'] = $currency->rate;
|
||||
|
||||
// Upload attachment
|
||||
$attachment_path = $this->getUploadedFilePath($request->file('attachment'), 'payments');
|
||||
if ($attachment_path) {
|
||||
$request['attachment'] = $attachment_path;
|
||||
}
|
||||
$payment = Payment::create($request->input());
|
||||
|
||||
Payment::create($request->input());
|
||||
// Upload attachment
|
||||
$media = $this->getMedia($request->file('attachment'), 'payments');
|
||||
|
||||
if ($media) {
|
||||
$payment->attachMedia($media, 'attachment');
|
||||
}
|
||||
|
||||
$message = trans('messages.success.added', ['type' => trans_choice('general.payments', 1)]);
|
||||
|
||||
@ -175,14 +176,15 @@ class Payments extends Controller
|
||||
$request['currency_code'] = $currency->code;
|
||||
$request['currency_rate'] = $currency->rate;
|
||||
|
||||
// Upload attachment
|
||||
$attachment_path = $this->getUploadedFilePath($request->file('attachment'), 'payments');
|
||||
if ($attachment_path) {
|
||||
$request['attachment'] = $attachment_path;
|
||||
}
|
||||
|
||||
$payment->update($request->input());
|
||||
|
||||
// Upload attachment
|
||||
if ($request->file('attachment')) {
|
||||
$media = $this->getMedia($request->file('attachment'), 'payments');
|
||||
|
||||
$payment->syncMedia($media, 'attachment');
|
||||
}
|
||||
|
||||
$message = trans('messages.success.updated', ['type' => trans_choice('general.payments', 1)]);
|
||||
|
||||
flash($message)->success();
|
||||
|
@ -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();
|
||||
|
@ -53,13 +53,14 @@ class Items extends Controller
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
// Upload picture
|
||||
$picture_path = $this->getUploadedFilePath($request->file('picture'), 'items');
|
||||
if ($picture_path) {
|
||||
$request['picture'] = $picture_path;
|
||||
}
|
||||
$item = Item::create($request->input());
|
||||
|
||||
Item::create($request->input());
|
||||
// Upload picture
|
||||
if ($media) {
|
||||
$media = $this->getMedia($request->file('picture'), 'items');
|
||||
|
||||
$item->attachMedia($media, 'picture');
|
||||
}
|
||||
|
||||
$message = trans('messages.success.added', ['type' => trans_choice('general.items', 1)]);
|
||||
|
||||
@ -137,14 +138,15 @@ class Items extends Controller
|
||||
*/
|
||||
public function update(Item $item, Request $request)
|
||||
{
|
||||
// Upload picture
|
||||
$picture_path = $this->getUploadedFilePath($request->file('picture'), 'items');
|
||||
if ($picture_path) {
|
||||
$request['picture'] = $picture_path;
|
||||
}
|
||||
|
||||
$item->update($request->input());
|
||||
|
||||
// Upload picture
|
||||
if ($media) {
|
||||
$media = $this->getMedia($request->file('picture'), 'items');
|
||||
|
||||
$item->syncMedia($media, 'picture');
|
||||
}
|
||||
|
||||
$message = trans('messages.success.updated', ['type' => trans_choice('general.items', 1)]);
|
||||
|
||||
flash($message)->success();
|
||||
|
Reference in New Issue
Block a user