mardi 15 juin 2021

alternate to first() to check full object in laravel

I use first() to check first text in string but i want to check whole string. what is method to do this?

suppose i have word "hello world" then its only checking "hello" how to check full name like "hello world"

I use get(), plunk(), slice() but it doesn't work for me.

private function getBrandIdFromName($brandName){
  $brand = Brand::query()->where('slug',$brandName)->filter($brandName);
        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;
        }
}


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3gwNLbD
via IFTTT

Aucun commentaire:

Enregistrer un commentaire