'No hint path defined for [xxx]
I'm trying to link in my package to a view also in the same package.
This is the file structure:
/report/src
/report/src/ReportServiceProvider.php
/report/src/views/test.blade.php
/report/src/SomeClass.php
In my ReportServiceProvider.php I specify the directory where the views should be loading from (like specified here):
public function boot()
{
$this->loadViewsFrom(__DIR__.'/views', 'reports');
}
With the 'hint' reports, so I should be able to access them with view('reports::test')
Off course I add my ServiceProvider to /config/app.php's providers array like so:
....
Vendor\Report\ReportServiceProvider::class,
....
I load my package in composer as follows:
"autoload": {
....
"psr-4": {
"App\\": "app/",
"Vendor\\Report\\": "packages/vendor/report/src"
}
...
}
But when I use the view('reports::test') in SomeClass.php i get the following error:
No hint path defined for [reports]
So somehow it cannot find the reports hint.... What am I missing here?
Solution 1:[1]
I think report is your package name,
Step 1: You must specify the package name inside the service provider
$this->loadViewsFrom(__DIR__.'/views', 'report');
Step 2: If you want to load the view
return view('packageName::Email.testmail'); //packageName is report, the actual path to my view is package/report/src/views/Email/testmail.blade.php
Solution 2:[2]
You need to add the package' service provider in cofing/app.php
Solution 3:[3]
I solved the error No hint path defined for [view] by putting the following code snippet on my service provider boot method of my package:
$this->loadViewsFrom(__DIR__.'/views', 'home');
Where home is my view file home.blade.php. As I am Laravel beginner, maybe in package builded type of coding in need to give the path of view files inside service provider.
Solution 4:[4]
if you have your blades views in ...views/xxx, that is how you can specify it:
app('xxx')->addNamespace('mail', resource_path('views') . '/xxx');
Solution 5:[5]
If you're using infyomlabs/adminlte-templates package just add service provider in config/app.php as shown below:
'providers' => [
// ...
InfyOm\AdminLTETemplates\AdminLTETemplatesServiceProvider::class,
// ...
],
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Manu Joseph |
| Solution 2 | Naveed Ali |
| Solution 3 | matiaslauriti |
| Solution 4 | Yevgeniy Afanasyev |
| Solution 5 | hsul4n |
