As this course intention is to teach you from basic and so, I’ll try to keep it as simple as I could.

First of all we need to open routes/web.php and make some changes to the file. If you open this file now then you will find code similar to this one.

routes/web.php
<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

Change #

Now, we will add one route to the routes/web.php file to understand how routes works in then laravel.

Earlier adding route was different but Laravel 8 introduced new wasy of doing this.

To make code cleaner, I removed the comment

routes/web.php
<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

Route::get('/test', function () {
    return view('test');
});
resource/views/test.php
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1>This is test page at test url</h1>
</body>
</html>
comments powered by Disqus