Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel withhas

public function index()
{
    $countryName = 'Brazil';
    $users = User::with('country')
		->whereHas('country', function (Builder $query) use($countryName) {
			$query->where('name', 'like', "%{$countryName}%");
		})
      ->get();
}
Comment

PREVIOUS NEXT
Code Example
Php :: run a server php terminal 
Php :: how to add recaptcha validation in php 
Php :: php check if file exists 
Php :: php foreach count rows 
Php :: root directory in php 
Php :: how to get last executed query in laravel 
Php :: laravel old value for select option 
Php :: json whereIn laravel 
Php :: How can I get current controller and current controller action name in yii2 
Php :: php redirect 404 page not found 
Php :: php randon integer 4 digit 
Php :: pass parameter to view laravel 
Php :: wordpress get template directory 
Php :: time in php 
Php :: php jquery plus 1 day 
Php :: php find part of string in array 
Php :: php controller 
Php :: check which database connect laravel 
Php :: php file put content 
Php :: csrf token mismatch laravel api 
Php :: php const 
Php :: php empty object 
Php :: only display part of string php 
Php :: php check string is int 
Php :: php date object to timestamp 
Php :: larvel make http request 
Php :: php get day number 
Php :: Notice: Trying to access array offset on value of type int in /var/www/pdam/modules/phpexcel/PHPExcel/Cell/DefaultValueBinder.php on line 82 
Php :: construtor php 
Php :: php begin 
ADD CONTENT
Topic
Content
Source link
Name
8+8 =