Creating a new page and linking to it in laravel

In Laravel, you can create a new page by creating a new blade template and then linking to it in your routes file. Here's a step-by-step guide:

Step 1: Create a new blade template

In the resources/views directory, create a new file with a name that corresponds to the page you want to create (e.g., about.blade.php).

Step 2: Add content to the blade template

In the new blade template, add the content you want to display on the page. For example:

<!-- resources/views/about.blade.php -->

<h1>About Us</h1>

<p>This is the about page.</p>

Step 3: Create a new route

In the routes/web.php file, add a new route that links to the new blade template. For example:

// routes/web.php

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

This route will match the /about URL and return the about blade template.

Step 4: Link to the new page

In your existing blade templates, you can link to the new page using the route function. For example:

<!-- resources/views/home.blade.php -->

<a rel="nofollow" target="_blank" href="{{ route('about') }}">About Us</a>

This will create a link to the /about page.

Step 5: Update your navigation menu (optional)

If you have a navigation menu in your layout, you'll need to update it to include a link to the new page. For example:

<!-- resources/views/layouts/master.blade.php -->

<nav>
    <ul>
        <li><a rel="nofollow" target="_blank" href="{{ route('home') }}">Home</a></li>
        <li><a rel="nofollow" target="_blank" href="{{ route('about') }}">About Us</a></li>
    </ul>
</nav>

That's it! You've created a new page and linked to it in Laravel.

Remember to update your routes file and blade templates accordingly, and don't forget to run php artisan route:cache and php artisan view:clear to clear the route cache and view cache, respectively.