I wrote a small application using Laravel 5.2. I keept all of my code as a bundle in one folder. All of my code is located in a folder called modules
in the root folder of my laravel installation.
I am hoping to follow this folder level
app
modules/Vendorname/Modulename
I managed to move my controllers and route fils out of my app
folder and into modules\Vendname\Modulename
Now, I am trying to move my views
out of the resources/views
folder and into modules\Vendname\Modulename\Views
To do that, I tried to follow the documentation for Package Development. I added the following code to my boot() method of my core service provider
public function boot()
{
//Bind the routes for this module
if (! $this->app->routesAreCached()) {
require __DIR__ . '/../routes.php';
}
//Bind the module views
$this->loadViewsFrom( __DIR__ . '/../Views', 'surveys');
}
Then in the controller, I call the views like so
return view('surveys::index');
To include a partial view from another view, I call it like this
@include('surveys::partials/_checkbox', compact('control') )
However, this is not working. I run into this error
InvalidArgumentException in FileViewFinder.php line 137: View [display] not found.
What did I miss here? What else do i need to do to correctly move my views?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire