Initial commit
This commit is contained in:
27
app/Imports/PropertiesImport.php
Normal file
27
app/Imports/PropertiesImport.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Imports;
|
||||
|
||||
use App\User;
|
||||
use Maatwebsite\Excel\Concerns\ToModel;
|
||||
|
||||
class PropertiesImport implements ToModel
|
||||
{
|
||||
private $rows = 0;
|
||||
|
||||
public function model(array $row)
|
||||
{
|
||||
++$this->rows;
|
||||
|
||||
return new User([
|
||||
'name' => $row[0],
|
||||
]);
|
||||
}
|
||||
|
||||
public function getRowCount(): int
|
||||
{
|
||||
return $this->rows;
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user