user7774558
user7774558

Reputation:

Laravel: how to display config?

I recently changed up my pages to use an extend header, because the header content was the same on every page, so it seemed like a great idea. Once I had done this my footer totally stopped working, well the configuration part of it. When I now try and get a configuration from Laravel it just displays as normal content, you can see below:

How the footer displays:

{{ Config::get('frontend.site_name') }} 2017 / Powered by the amazing {{ config('frontend.powered_by') }}.
Copyright © 2017 {{ Config::get('frontend.website_author') }}, and others who have supported this project. All rights reserved.

Header (the view it extends):

<!DOCTYPE html>
<html lang="{{ config('app.locale') }}">
<head>
    <title>{{ config('frontend.site_name') }} - @yield('title')</title>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <link href="{{ config('frontend.assets_path') }}/css/override.css" rel="stylesheet" type="text/css">
</head>
<body id="home">
    <div class="container">
        <br>
        @yield('body')
    </div>
    @include('frontend.footer')
</body>
</html>

actual view:

@extends('frontend.header')
    @section('title')
        Home
    @endsection
    @section('body')
    Write something here soon
    @endsection

Frontend.footer:

    <div class="container">
        <div class="col-md-12" style="margin-bottom:2%;">
            {{ Config::get('frontend.site_name') }} <?php echo date("Y"); ?> / Powered by the amazing {{ config('frontend.powered_by') }}.<br>
            Copyright © 2017 {{ Config::get('frontend.website_author') }}, and others who have supported this project. All rights reserved.
        </div>
    </div>
    <script src="https://use.fontawesome.com/905fc4df74.js"></script>
    <script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</body>
</html>

Upvotes: 1

Views: 522

Answers (1)

Alexey Mezenin
Alexey Mezenin

Reputation: 163898

Make sure the file name has .blade part:

resources/views/frontend/footer.blade.php

Upvotes: 1

Related Questions