laravel新项目尚未运行仍在浏览器中加载

  1. installing laravel new project
composer create-project --prefer-dist laravel/laravel newProject

Project running perfect in http://localhost:8000/ in this port after some time page loading stil

and clear everything in this project i think its cache error

php artisan cache:clear
php artisan config:clear
php artisan view:clear

project running for 2 min then still again loading

then this project change port like

php artisan serve --port 9000 same as working for 2 or 3 min then still loading

i dont know whats problem in this project any idea for this ?

i tried same project on my second system working fine

Yah i got a answer

its not a php error operating system problem

thats why auto remove server.php file in my project

  • Its better solution is update your operating system
  • php artisan serve manually serve project its working fine like php -S localhost:8000 -t path
Route::get('/user', 'YourController@YourControllerFunction')->middleware('auth');

Or if you have many api's that need to use the authentication middleware then create a group like:

Route::group(['middleware' => 'auth'], function () {
    Route::get('/user', 'YourController@YourControllerFunction');
});

Also keep in mind that the auth:api middleware requires a token to be generated for user authentication.