2

Using maatwebsite plugin to import excel file data into database. But i want save the imported filename also?


class UsersImport implements ToModel, WithHeadingRow
{
    /**
    * @param array $row
    *
    * @return \Illuminate\Database\Eloquent\Model|null
    */
    public function model(array $row)
    {
        return new User([
            "first_name" => $row['first_name'],
            "last_name" => $row['last_name'],
            "email" => $row['email'],
            "mobile_number" => $row['mobile_number'],
            "role_id" => 2, // User Type User
            "status" => 1,
            "password" => Hash::make('password')
        ]);
    }
}```

Pls any one help me to get the FIle name also.
Note(Followed):https://dev.to/techtoolindia/import-excel-file-into-laravel-8-3kif

0 Answers0