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.
 
 
 
 
 
 

31 lines
788 B

<?php
namespace App\Imports;
use App\Models\m_warehouse;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Auth;
use Maatwebsite\Excel\Concerns\ToModel;
use Maatwebsite\Excel\Concerns\ToCollection;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
class WarehouseImport 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 m_warehouse([
'name' => $row['name'],
'description' => $row['description'],
'address' => $row['address'],
'created_by' => $user->fullname,
]);
}
}