how filter in model file

Posted 7 months ago by haizone

hi i have a model is name "city"

and i have that function:

 public function branches()
    {
         return $this->hasMany('App\Models\Branch')
          ->where('business_id','>','0');
    }

i have table business has many branches.

now i whant only where in business.rest == 1 to filter that and get only where in business table in rest ==1

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.