I intend to display a jumbotron in multiple pages of my application, I have been able to display it on the home page, how do I replicate such on other pages.
I'm using Laravel 5.8 and Bootstrap 4 .It displayed on the default home page('/')
, I have tried replacing ('/')
with the page name in the route file which is 'training'
(from ...->name('training')
) i.e but it didn't display. I have also tried replacing it with '/Training'
and 'pages/training'
but it still didn't work.
The code in the master blade file (resources/views/layout/app.blade.php) is;
@if (Request::is('training'))
@include('inc.showcase')
@endif
The code for the showcase file (resources/views/inc/showcase.blade.php) is;
<div class="jumbotron text-center">
<div class="container">
<p>Welcome to My Page</p>
</div>
</div>
The code for the child blade (resources/views/pages/training.blade.php) is;
@extends('layout.app')
@section('content')
<h1>Training</h1>
@endsection
That of the route file (routes\web.php) is;
Route::get('/Training', 'PageController@getTraining')->name('training');
And that of the controller (app\Http\Controllers\PageController.php) is;
public function getTraining(){
return view('pages/training');
}
I expect the Jumbotron to display in the training page but nothing displays at all, except for the home page when i use (/)
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire