|
Server : Apache/2.4.41 (Ubuntu) System : Linux vmi1525618.contaboserver.net 5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022 x86_64 User : www-data ( 33) PHP Version : 8.2.12 Disable Function : NONE Directory : /var/www/peoplebee.in/___accounts-admin/app/Imports/ |
Upload File : |
<?php
namespace App\Imports;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
use App\Models\Master;
use Maatwebsite\Excel\Concerns\ToModel;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
use App\Models\State;
use App\Models\District;
use App\Models\Block;
use App\Models\Zila_panchayat;
use App\Models\School;
use App\Models\School_class;
use App\Models\User;
class EmployeeImport implements ToModel,WithHeadingRow
{
/**
* @param array $row
*
* @return \Illuminate\Database\Eloquent\Model|null
*/
public function model(array $row)
{
// dd($row);
$mainArray = array();
$rowArray = array(
'user_unique_id' =>$row['id'],
'ip_address' =>$_SERVER['REMOTE_ADDR'],
'admin_id' =>1,
'name' =>$row['firstname'],
'firstname' =>$row['firstname'],
'logUsername' =>$row['username'],
'email' =>$row['email'],
'phone' =>$row['phone'],
'password' =>Hash::make($row['password']),
'status' =>'1',
'created_at' =>date('Y-m-d H:i:s')
);
array_push($mainArray,$rowArray);
$res = User::insert($mainArray);
}
}