Laravel Excel Not Getting Data


When I am importing data from excel after getting the file and on the step of saving data to db it showing field doesn’t have value. Where as all the fields are filled with data.

i am using laravel excel

LeadImport Code

 return new lead([
        'name'  => $row[0],
        'leadid'  => $row[1],
        'number'   => $row[2],
        'city'  => $row[3],
        'state' => $row[4],
        'address'   => $row[5],
        'pincode'   => $row[6],
        'type'  => $row[7],

Controller Code
Excel::import(new LeadsImport, $request->file('file'));


SQLSTATE[HY000]: General error: 1364 Field 'leadid' doesn't have a default value (SQL: insert into `leads` (`updated_at`, `created_at`) values (2022-01-14 19:24:21, 2022-01-14 19:24:21))

Source: Laravel

Categorised as laravel, laravel-excel Tagged ,


Leave a Reply

Still Have Questions?

Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us