jeudi 25 mai 2017

Laravel 5.4 - @extends not working

I have two main views in Laravel.

Both are called as follows, in web.php:

Route::get('/characters', 'CharacterController@index');
Route::get('/characters/{char_id}', 'CharacterController@viewCharacter');

Here's their function in CharacterController:

/characters:

public function index()
{



$characters = Character::userChars();

return view('pages.characters', compact('characters') );


}

characters/{char_id}:

public function viewCharacter ($char_id)

{

    $character = \DB::table('characters')->where('char_id', $char_id)->first();

    return view('pages.view-character', compact('character') );


}

/characters works fine. It uses

@extends('layouts.master')

@section('content')

@endsection

All the content loads fine and the CSS displays.

However, characters/{char_id} refuses to work correctly.

It displays only the HTML I have on the page. I have a die-dump on it which works fine with {char_id}. It seems to be ignoring @extends('layouts.master') because it isn't showing my nav bar or any other partials I have set up.

This is the blade template for characters/{char_id}:

@extends('layouts.master')

@section('content')

<div id="page-wrapper">

            <div class="container-fluid">

                <!-- Page Heading -->
                <div class="row">
                    <div class="col-lg-12">
                        <h1 class="page-header">
                            Template <small>Template Page</small>
                        </h1>
                        <ol class="breadcrumb">
                            <li class="active">
                                <i class="fa fa-dashboard"></i> Template 1
                               

                            </li>
                        </ol>
                    </div>
                </div>








            </div>
</div>

@endsection

It is identical to the view that /characters uses, except for what's in the content section.

Thanks!



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2qZgBqU
via IFTTT

Aucun commentaire:

Enregistrer un commentaire