private function getBrandIdFromName($brandName){
        $brand = Brand::query()->where('slug',$brandName)->first();
        
        if($brand){
            return $brand->id;
        }else{
            $newBrand = [
                'name'=>$brandName,
                'is_active'=>"1",
                'meta'=>[
                    'meta_title'=>null,
                    'meta_description'=>null,
                ]
            ];
            $brand = Brand::create($newBrand);
            return $brand->id;
        }
    }
this is my code when i import one text "nike" its working well. but when i import 2 text like "nike world" its importing text "nike world" again and again when i import text again. please do help if anyone has solution.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire