import
This commit is contained in:
@ -10,7 +10,7 @@ use App\Models\Expense\Vendor;
|
||||
use App\Models\Setting\Category;
|
||||
use App\Models\Setting\Currency;
|
||||
use App\Traits\Uploads;
|
||||
|
||||
use App\Utilities\ImportFile;
|
||||
use App\Utilities\Modules;
|
||||
|
||||
class Payments extends Controller
|
||||
@ -108,6 +108,31 @@ class Payments extends Controller
|
||||
return redirect('expenses/payments/' . $clone->id . '/edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Import the specified resource.
|
||||
*
|
||||
* @param ImportFile $import
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function import(ImportFile $import)
|
||||
{
|
||||
$rows = $import->all();
|
||||
|
||||
foreach ($rows as $row) {
|
||||
$data = $row->toArray();
|
||||
$data['company_id'] = session('company_id');
|
||||
|
||||
Payment::create($data);
|
||||
}
|
||||
|
||||
$message = trans('messages.success.imported', ['type' => trans_choice('general.payments', 2)]);
|
||||
|
||||
flash($message)->success();
|
||||
|
||||
return redirect('expenses/payments');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
|
Reference in New Issue
Block a user