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.
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3vyFvNB
via IFTTT
Aucun commentaire:
Enregistrer un commentaire