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
778 B
31 lines
778 B
1 year ago
|
<?php
|
||
|
|
||
|
namespace App\Imports;
|
||
|
|
||
|
use App\Models\Kondisi_Peti;
|
||
|
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 KondisiPetiImport 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 Kondisi_Peti([
|
||
|
'nama_kondisi' => $row['nama_kondisi'],
|
||
|
'deskripsi_kondisi' => $row['deskripsi_kondisi'],
|
||
|
'created_by' => $user->fullname,
|
||
|
]);
|
||
|
}
|
||
|
}
|