Reputation: 21
I have created a Package in laravel and i am not able to include the package between header and footer of the page. Please find the code below,
$this->loadViewsFrom(__DIR__.'\views','details');
How to include the package between header and footer section of a website ? Please help me to resolve the issue.
The package have the following structure as show below
--Root
--packages
--events
--details
--src
--assets
--Models
--Request
--Views
routes.php
DetailsServiceProvider.php
DetailsController.php
composer.json
Upvotes: 0
Views: 809
Reputation: 6720
In your service provider you will register a view namespace using the code:
$this->loadViewsFrom(__DIR__.'\relative\path\from\service-provider','details');
Now you would be able to load files using view('details::template-file')
which will look for the path \relative\path\from\service-provider\template-file.blade
or by including them in other blade files: @include('details::template-file')
Upvotes: 1