use PhpOffice\PhpSpreadsheet\Shared\Date;
public function map($user): array
{
return [
$user->username,
Date::stringToExcel($user->deleted_at)
];
}
public function headings(): array{
return [
"username",
"deleted_at",
];
}
use PhpOffice\PhpSpreadsheet\Shared\Date;
public function model(array $row)
{
if(Date::excelToTimestamp($row["deleted_at"]) != 0){
$deleted_at = Date::excelToTimestamp($row["deleted_at"]);
}else{
$deleted_at = null;
}
return new User([
'username' => $row["username"],
'deleted_at' => $deleted_at,
]);
}
protected $fillable = [
'username',
'deleted_at'
];