StudentX
StudentX

Reputation: 2323

Extending view in Laravel 5.4 package

I am getting View [layouts.app] not found ErrorException when I extend my app view in another view in a laravel package I am working on.

This is the directory structure I have for the views:

vendor
-Student
--myPackage
---src
----views
-----layouts
------app.blade.phph
-----myView
------viewfile.blade.php

Now If I extend layouts.app like so @extend('layouts.app') in viewfile.blade.php then I get this ErrorException exception. Although, if I don't extend a layouts.blade view, I can access the view viewfile.blade without any problem.

My views are registered like so in the package `ServiceProvider's boot method

$this->loadViewsFrom(__DIR__ . '/Views', 'studentViews');

I am using Laravel 5.4 Laravel 5.4 Package Development-Views

Upvotes: 3

Views: 1331

Answers (1)

Jerodev
Jerodev

Reputation: 33186

You have to add your package name to the view name as stated in the documentation.

So you would have to use:

@extends('studentViews::layouts.app')

Upvotes: 8

Related Questions