I need to export data with Laravel Export, but the code return ErrorException: Attempt to read property “second_key” on null. My code: I’ve tried to check using this: print_r(json_encode($data->json_data)); and this is the result: I’ve also done this: and the excel cell returns the same result: Answer As @dbf said in the comment section, I have to handle empty rows.
Tag: laravel-excel
How to save data to db using laravel import?
I have prepared code below, and I’m using the dump to trace if it passed to models’ create function. When I checked in the database there is no data added, I’m just wondering why it does not have when it is already passed in User::create function (verified by string “created” below in the picture). These are the dump datas returned
PhpSpreadsheet Reader Exception Failed to load /root_dir/public/laravel-excel-fLRGTlw9uEE2XRz0k1fXdcg2wfs2RWy7.html as a DOM Document
I have tried everything for resolving this issue but nothing worked. php artisan cache:clear php artisan view:clear php artisan route:clear php artisan config:clear Also Updated my Dependencies …
No query results for model [AppUser] NULL 387 /laravel/framework/src/Illuminate/Database/Eloquent/Builder.php
I know a similar question has been asked but the reasons for those error does not imply in my case because I am not fetching results anywhere in code. I am not using the ‘find’ or ‘findOrFail’ method anywhere in code. I am getting this error: My Excel import code: In my controller: PS: I tried User::create($user); but the same