Laravel视图不显示

时间:2017-02-14 15:02:47

标签: laravel blade laravel-blade

我点击页面后嗨:

<a href="{{ url('pages') }}">Websites</a>

我收到错误消息:

  

查看[layoults.pages]未找到。

路线:

Route::get('pages', 'BuilderController@websites');

控制器:

function websites()
    {
        $websites = Website::all();
        return view('layoults/pages', ['websites' => $websites]);
        $webid= $websites->id;
    }

pages.blade.php:

@extends('layouts.master') @section('title', 'Website Builder') @section('content')
<meta name="csrf-token" content="{{ csrf_token() }}" />
<div class=flex-container>
    <div class="flex-item templates">

        @foreach ($websites as $website)
        <a class="content-link" href="{{ asset($website->name )}}">
        </a> @endforeach

    </div>
</div>        
        </body>
        <link href="{{asset('css/bootstrap-colorpicker.min.css')}}" rel="stylesheet" type="text/css">
        <link href="{{asset('css/bootstrap-formhelpers.min.css')}}" rel="stylesheet" type="text/css">
        <link href="{{asset ('//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css')}}" rel="stylesheet" type="text/css">
        <script type="text/javascript" src="{!! asset('js/bootstrap-colorpicker.min.js') !!}">
        </script>
        <script type="text/javascript" src="{!! asset('js/bootstrap-formhelpers.js') !!}">
        </script>
        <script type="text/javascript" src="{!! asset('js/template.js') !!}"></script>
        <script type="text/javascript" src="{!! asset('js/bootstrap-filestyle.min.js') !!}">
        </script>

        </html>
        @endsection @show

有人可以告诉我发生了什么事吗?据我所知,一切似乎都是正确的。

1 个答案:

答案 0 :(得分:1)

typo in your code try following lines in your controller

function websites()
{
   $websites = Website::all();
   return view('layouts/pages', ['websites' => $websites]);
}