Pages using Laravel won’t load

  laravel, php

The pages I made with php and laravel don’t seem to load. They connect to the url, but the content of the pages is returning empty. This happens with all my pages, and I can’t seem to find why.

This is my route:

<?php

use IlluminateSupportFacadesRoute;
//use AppHttpControllersShopShopController;

Route::view ('/', 'pages.home');
Route::view ('about', 'pages.about');

Route::get ('shop', '[email protected]');
Route::get ('shop/{category}', '[email protected]');
Route::get ('shop/{category}/{product}', '[email protected]');

Route::get('add-to-cart/{product_id}', '[email protected]');
Route::post('add-to-cart', '[email protected]') ;
Route::get ('cart', '[email protected]');
Route::post('update-cart', '[email protected]');
Route::get('delete-item/{row_id}', '[email protected]');
Route::get('delete-cart', '[email protected]');

Route::get('signup', '[email protected]') ;
Route::post('signup', '[email protected]') ;

Route::get('login', '[email protected]') ;
Route::post('login', '[email protected]') ;

Route::get('logout', '[email protected]') ;
Route::get('place-order', '[email protected]') ;

Route::get('admin', '[email protected]')->middleware('validate_admin') ;
Route::get('admin/orders', '[email protected]')->middleware('validate_admin') ;

Route::resource('admin/categories', 'AppHttpControllersAdminCategoryCrudContoller')->middleware('validate_admin');
Route::resource('admin/products', 'AppHttpControllersAdminProductCrudContoller')->middleware('validate_admin');
Route::resource('admin/users', 'AppHttpControllersAdminUserCrudContoller')->middleware('validate_admin');
Route::resource('admin/pages', 'AppHttpControllersAdminPageCrudContoller')->middleware('validate_admin');

Route::get('slug', '[email protected]');

My template’s header and nav where to urls are set:

<header class="mb-5">
    <nav class="navbar navbar-expand-lg navbar-light bg-light">
        <div class="container">
            <a class="navbar-brand" href="{{url('/')}}"><img class="nav-logo" src="{{asset('images/logo.png')}}"></a>
          <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
          </button>
          <div class="collapse navbar-collapse" id="navbarSupportedContent">
            <ul class="navbar-nav mr-auto">
              <li class="nav-item active">
                <a class="nav-link" href="{{url('/')}}">Home <span class="sr-only">(current)</span></a>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="{{url('about')}}">About</a>
              </li>
              @unless(! $pages->isEmpty())
              <li class="nav-item dropdown">
                <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                  News
                </a>
                <div class="dropdown-menu" aria-labelledby="navbarDropdown">
                  @foreach($pages as $page)
                  <a class="dropdown-item" href="{{url('$page->slug')}}">{{$page->name}}</a>
                  @endforeach
                </div>
              </li>
              @endunless
              <li class="nav-item">
                <a class="nav-link" href="{{url('shop')}}">Shop</a>
              </li>
            </ul>
              <ul class="navbar-nav ml-auto">
                  @if(session('id'))
                  @if(session('role')===42)
                  <li>
                      <a class="nav-link font-weight-bold" href="{{url('admin')}}">{{session('name')}} Admin Dashboard︎︎ </a>
                  </li>
                  @endif
                  <li>
                      <a class="nav-link" href="{{url('logout')}}">{{session('name')}} Logout</a>
                  </li>
                  @else
                  <li>
                      <a class="nav-link" href="{{url('signup')}}"> Sign Up </a>
                  </li>
                  <li>
                      <a class="nav-link" href="{{url('login')}}"> Login</a>
                  </li>
                  @endif
              </ul>
              <div id="mini-cart">
                  <a href="{{url('cart')}}"></a>
                  <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-basket3" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
                  <path fill-rule="evenodd" d="M5.757 1.071a.5.5 0 0 1 .172.686L3.383 6h9.234L10.07 1.757a.5.5 0 1 1 .858-.514L13.783 6H15.5a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5H.5a.5.5 0 0 1-.5-.5v-1A.5.5 0 0 1 .5 6h1.717L5.07 1.243a.5.5 0 0 1 .686-.172zM3.394 15l-1.48-6h-.97l1.525 6.426a.75.75 0 0 0 .729.574h9.606a.75.75 0 0 0 .73-.574L15.056 9h-.972l-1.479 6h-9.21z"/>
                  </svg>
                  <span>{{$cart_count?:''}}</span>
              </div>
          </div>
        </div>
    </nav>
</header>

and an example of one of my pages:

@extends('template')
@section('content')

<h1> Home Page </h1>
@endsection

This issue it really new, since it worked well yesterday. I’m a noob to laravel, so I apologize if I asked something rather silly (also, this didn’t return an error page for me).

Source: Laravel

Leave a Reply