Reputation: 3833
I am getting this error:
View [layouts.master] not found. (View: C:\xampp5\htdocs\laravel\laravel\resources\views\page.blade.php)
This is my master.blade.php:
<html>
<head>
<title>@yield('title')</title>
</head>
<body>
@section('sidebar')
This is the master sidebar.
@show
<div class = "container">
@yield('content')
</div>
</body>
</html>
This is the page.blade.php:
@extends('layouts.master')
@section('title', 'Page Title')
@section('sidebar')
@parent
<p>This is appended to the master sidebar.</p>
@endsection
@section('content')
<h2>{{$name}}</h2>
<p>This is my body content.</p>
@endsection
And here is the relevant section of route:
Route::get('blade', function () {
return view('page',array('name' => 'Random Name'));
});
Upvotes: 3
Views: 493
Reputation: 2736
Do like this
@extends('master')
@section('title', 'Page Title')
@section('sidebar')
@parent
<p>This is appended to the master sidebar.</p>
@endsection
@section('content')
<h2>{{$name}}</h2>
<p>This is my body content.</p>
@endsection
Upvotes: 1
Reputation: 163758
Put master.blade.php
in this directory:
C:\xampp5\htdocs\laravel\laravel\resources\views\layouts
Or change path for the layout:
@extends('layouts.master')
to this:
@extends('master')
Upvotes: 6