Answers for "select with laravel"

PHP
2

eloquent with select

Post::query()
    ->with(array('user' => function($query) {
        $query->select('id','username');
    }))
    ->get();
Posted by: Guest on August-07-2021
7

laravel wher in

$users = DB::table('users')
                    ->whereIn('id', [1, 2, 3])
                    ->get();
Posted by: Guest on April-30-2020
2

laravel query builder select

use Illuminate\Support\Facades\DB;

$users = DB::table('users')
            ->select('name', 'email as user_email')
            ->get();
Posted by: Guest on August-14-2021
-1

laravel having

$users = DB::table('users')
                ->groupBy('account_id')
                ->having('account_id', '>', 100)
                ->get();
Posted by: Guest on June-18-2020

Browse Popular Code Answers by Language