laravel where condition on relationship
App\Request::where('id',4)
->whereHas('quotes', function ($query) {
$query->where('status','=','3');
})
->with('quotes','sourceTable','destinationTable')
->get();
laravel where condition on relationship
App\Request::where('id',4)
->whereHas('quotes', function ($query) {
$query->where('status','=','3');
})
->with('quotes','sourceTable','destinationTable')
->get();
wherein laravel
DB::table('user')->whereIn('id', [100,200])->get();
laravel db::query update
DB::table('user')->where('email', $userEmail)->update(array('member_type' => $plan));
laravel where and where
Table::where('Column', Value)->where('NewColumn', Value)->get();
laravel where condition with if
$query = DB::table('user_ads')
->join('ads', 'users_ads.ad_id', '=', 'ads.id')
->orderBy($column, $method);
if ($input['search']) {
$query->where('short_description', $input['search']);
}
if ($input['category']) {
$query->where('category', $input['category']);
}
$query->join('users', 'users_ads.user_id', '=', 'users.id')
->select('ads.id', 'ads.img1', 'ads.short_description', 'ads.category', 'ads.product', 'ads.price', 'users.city')
$result= $query->get();
return $result;
laravel when condition
$invisiblePosts = $request->query('invisible');
Article::query()
->when($invisiblePosts , function ($query){
return $query->where('invisible' , true);
},function ($query){
return $query->where('invisible' , false);
})
->get();
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us