Reputation: 382
I'm changing this question as I have first half of answer now. I have created 2 new Laravel apps using
composer create-project laravel/laravel myApp
Both builded fine. Both of them works i.e. the welcome page shows.
But in both cases there is no routes file in App/Http
Creating a routes file doesn't help as it ignores it.
If I create apps with 5.2 it works:
composer create-project laravel/laravel myApp 5.2.*
These have the routes file in.
How do I fix my 5.3 installation?
I'm running it on a local Windows setup.
Upvotes: 1
Views: 8344
Reputation: 1314
In Latest version of Laravel framework 7.5.2 routes.php is not located inside laravel > App > Http folder.
App/Http/routes.php => this file is not available (that means not located) in latest laravel Framework
instead you can find routes folder inside laravel > routes folder
In that there will be web.php file where you have to implement your new code so that code will works good
https://i.sstatic.net/WvPft.png
So let me go to root routes/ directory in that you can able to find web.php in that apply below code
https://i.sstatic.net/DqVyx.png
Result will be : https://i.sstatic.net/3WMzW.png
Upvotes: 0
Reputation: 770
In Laravel 5.3, the app/Http/routes.php
file has now moved to the root routes/
directory, and it's now split into two files: web.php
and api.php
. As you can probably guess, the routes in routes/web.php
are wrapped with the web middleware
group and the routes in routes/api.php
are wrapped with the api middleware
group.
If you want to customize this or add your own separate routes files, check out App\Providers\RouteServiceProvider
this file:
public function map()
{
$this->mapApiRoutes();
$this->mapWebRoutes();
//
}
protected function mapApiRoutes()
{
Route::group([
'middleware' => ['api', 'auth:api'],
'namespace' => $this->namespace,
'prefix' => 'api',
], function ($router) {
require base_path('routes/api.php');
});
}
protected function mapWebRoutes()
{
Route::group([
'namespace' => $this->namespace, 'middleware' => 'web',
], function ($router) {
require base_path('routes/web.php');
});
}
You can customize your costume routes with change in this file.
Upvotes: 6
Reputation: 382
For Laravel 5.3 routes.php doesn't exist anymore. There's now 3 x route file in a folder called routes (projectroot/routes)
Upvotes: 9