Answers for "laravel where condition"

PHP
1

laravel where condition on relationship

App\Request::where('id',4)
    ->whereHas('quotes', function ($query) {
        $query->where('status','=','3');
    })
    ->with('quotes','sourceTable','destinationTable')
    ->get();
Posted by: Guest on November-30-2020
2

wherein laravel

DB::table('user')->whereIn('id', [100,200])->get();
Posted by: Guest on December-16-2020
0

laravel db::query update

DB::table('user')->where('email', $userEmail)->update(array('member_type' => $plan));
Posted by: Guest on November-19-2020
0

laravel where and where

Table::where('Column', Value)->where('NewColumn', Value)->get();
Posted by: Guest on September-04-2020
0

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;
Posted by: Guest on September-13-2020
0

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();
Posted by: Guest on February-12-2021

Code answers related to "laravel where condition"

Browse Popular Code Answers by Language