//routesweb.php
Route::get('/get-10-records', [HomeController::class, 'getRecords']);
//Create controller if not exists using
php artisan make:controller HomeController
//appHttpControllersHomeController.php
use AppModelsUser;
class HomeController extends Controller
{
public function getRecords(){
$users = User::select('*')->take(10)->get();
return response()->json($users);
}
}