1 year ago

#206660

test-img

furkan

While importing in Laravel, the Data is Null in AA columns. How Can I Solve This?

when I import the excel file with laravel excel import, A-Z has no problem, but it returns null in AA AB classes.

When I remove the columns, it does the operation, and when I add it, it returns all the data to null.

public function collection($row)
{
    $vehicle_model = VehicleModel::where('name', $row['model'])->first();

    $vehicle_model = @$vehicle_model->id;
  
    $vehicle_company = Company::where('name', '=', $companyName)->first();
    $vehicle_different = Vehicle::where('license_plate', '=', $row['plaka'])->first();
    $vehicle_company = @$vehicle_company->id;
    $vehicle_location = Location::where('slug', '=', $row['sube'])->first();
    $vehicle_location = @$vehicle_location->id;

    $vehicle_brand = VehicleBrand::where('name', '=', $row['marka'])->first();
    $vehicle_brand = @$vehicle_brand->id;

    $vehicle_engine_capacity = VehicleEngineCapacity::where('capacity', 'LIKE', "%".$row['motor_hacmi']."%")->first();
    $vehicle_engine_capacity = @$vehicle_engine_capacity->id;

    $vehicle_colour = VehicleColour::where('name', 'LIKE', "%".$row['renk']."%")->first();
    $vehicle_colour = @$vehicle_colour->id;

    $vehicle_tire = VehicleTireType::where('name', '=', $row['lastik_adi'])->first();
    $vehicle_tire = @$vehicle_tire->id;

    if ($vehicle_different != null) {
        // abort(500, $row["plaka"].' Zaten Sistemde Kayıtlı');
    }

    if ($vehicle_model == null) {
        // abort(500, $row["plaka"].' Model Bulunamadı');
    }
    if ($vehicle_company == null) {
        abort(500, $row["plaka"].' Araç Firması Bulunamadı');
    }
    if ($vehicle_location == null) {
        abort(500, $row["plaka"].' araç Lokasyonu Bulunamadı');
    }
    if ($vehicle_colour == null) {
        abort(500, $row["plaka"].' araç Rengi Bulunamadı');
    }
    if ($vehicle_brand == null) {
        abort(500, $row["plaka"].' araç Rengi Bulunamadı');
    }
    if ($vehicle_engine_capacity == null) {
        abort(500, $row["plaka"].' araç Motor Hacmi Bulunamadı');
    }
    if ($vehicle_tire == null) {
        abort(500, $row["plaka"].' araç Lastik Tipi Bulunamadı');
    }
    dd($row);

There is no problem in the code above, values are returned in dd()

But When Adding AA and AB Stunts to Excel

enter image description here

laravel

laravel-excel

0 Answers

Your Answer

Accepted video resources