Siopas Inventory PETI for ISTW Website
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

32 lines
822 B

<?php
namespace App\Imports;
use App\Models\Customer;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Maatwebsite\Excel\Concerns\ToModel;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
class CustomerImport implements ToModel, WithHeadingRow
{
/**
* @param array $row
*
* @return \Illuminate\Database\Eloquent\Model|null
*/
public function model(array $row)
{
// Mendapatkan informasi pengguna yang sedang login
$user = Auth::user();
return new Customer([
'name' => $row['name'],
'code_customer' => $row['code_customer'],
'lot_no' => $row['lot_no'],
'no_tlp' => $row['no_tlp'],
'address' => $row['address'],
'created_by' => $user->fullname,
]);
}
}