jeudi 20 mai 2021

Laravel simple request is toooooo slow

I have a problem: When trying to get a single user from the database using laravel controller response is just too slow. Response time is over 1000ms, see Postman screenshot below.

Below is my code:

Controller:

public function getUserData(Request $request)
{
    return User::where('id',3)->select('name')->first();
}

web.php

Route::prefix('data-controller')
->name('data.controller')
->middleware([])
->group(static function(){

    Route::get('/get-user-data', 'DataController@getUserData')->name('getUserData');
});

.env

APP_NAME=AppName
APP_ENV=production
APP_KEY=base64:MEw1jEc7qyYhz4vIgxpZIqkjkfdkjfpasdfbURtoQ67HS6KsSBajwMC0=
APP_DEBUG=false
APP_URL=127.0.0.1
LOG_CHANNEL=single

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=mydb
DB_USERNAME=root
DB_PASSWORD=******

#SESSION_SECURE_COOKIE=true

BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=database
SESSION_DRIVER=anonymous-database
SESSION_LIFETIME=120

ACCESS_ALLOW_IP=
ACCESS_ALLOW_IP_ON=false

Postman screenshot

I appreciate all of you ideas and help, I'm slowly but surely loosing my mind with this problem.

Thank you in advance! If you need any more information I'll gladly provide it in this post's edit.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire