Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

View [layouts.app] not found. Laravel Framework 5.4.36

I am having a problem using Laravel Framework 5.4.36 (on Visual studio code). I am trying to build a simple layout, but no mater how much I've tried I am getting the same error on my browser :

View [layouts.app] not found. (View: C:\wamp64\www\lsapp\resources\views\pages\services.blade.php)

as you can see (photo bellow) the file is deferentially there, in the right path.enter image description here

Here is my code for my layout app.blade.php :

<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>{{config('app.name','LSAPP')}}</title>
</head>
<body>
       @yield('content')
</body>

and here is my code from services.blade.php

@extends('layouts.app')
@section('content')
        <h1>services</h1>
        <p>This is the services page</p>
@endsection

I have also installed Laravel Blade Snippets v 1.13.0 (1.14.1 was giving me another problem).

I have tried to change name and path both to the layout file and inside the extends parameter. Any ideas why this is not working?

Thank you very much in advance for your help..!

like image 930
Filip123go Avatar asked Feb 17 '18 00:02

Filip123go


2 Answers

You must reference a blade template relative to the resources/views directory. According to the screenshot your directory structure is:

resources
  ↳views
    ↳pages
      ↳layouts
         app.blade.php

Therefore your app.blade.php layout is available as pages.layouts.app:

@extends('pages.layouts.app')
like image 123
sam Avatar answered Nov 16 '22 03:11

sam


Change

@extends('layouts.app')

To

@extends('pages.layouts.app')
like image 2
Prince Lionel N'zi Avatar answered Nov 16 '22 02:11

Prince Lionel N'zi