use IlluminateSupportFacadesDB;
class UserController extends Controller
{
public function index()
{
$users = DB::table('users')->select('id','name','email')->get();
return view('some-view')->with('users', $users);
}
}
$users = DB::table('users')->get();
foreach ($users as $user) {
echo $user->name;
}