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;
        }
}


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire