mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-23 06:24:03 +00:00
export and import
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Imports;
|
||||
|
||||
use App\Classes\Modules\Imports\Services\ImportsDebtor;
|
||||
use App\Classes\General\ExcelHandel;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
|
||||
class ImportUpdateDebtorController
|
||||
{
|
||||
public function import(Request $request) {
|
||||
$token = Auth::fromUser(User::find(1));
|
||||
$request->headers->set('Authorization', 'Bearer '.$token);
|
||||
|
||||
$excel_file = $request->input('excel_file');
|
||||
|
||||
$excel_file = ExcelHandel::insertExcel('debtor', $excel_file);
|
||||
|
||||
return $import = Excel::import(new ImportsDebtor(), $excel_file[0]['file_info']['original']['file']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user