Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel with where has

public function index()
{
    $countryName = 'Brazil';
    $users = User::with('country')
		->whereHas('country', function (Builder $query) use($countryName) {
			$query->where('name', 'like', "%{$countryName}%");
		})
      ->get();
}
Source by www.itsolutionstuff.com #
 
PREVIOUS NEXT
Tagged: #laravel
ADD COMMENT
Topic
Name
7+2 =