use IlluminateSupportFacadesDB;
$users = DB::table('users')
->select('name', 'email as user_email')
->get();
$house=house::where('id',1)
->orderBy('id')
->take(1)
->get();
dd($house);
$email = DB::table('users')->where('name', 'John')->value('email');
use IlluminateDatabaseEloquentBuilder;
public function scopeFakePersons(Builder $query): Builder
{
return $query->where('is_fake', 1);
}
public function index()
{
$users = User::select("*")
->whereIn('id', [4, 5, 6])
->get();
dd($users);
}
use IlluminateSupportFacadesDB;
$users = DB::table('users') // Table name
->get() //Get all users
->where('name', 'John') // Where clause
->first() //First result
->groupBy('status') //Grouping