Laravel 5.2 : No hint path defined for [flash]

匆匆过客 提交于 2019-12-10 13:42:17

问题


After installed "laracasts/flash": "^1.3" package, I am trying to make a view and this is my code:

@include('gazett.errors')

Where in gazett.errors blade.php file code is here :

<div class="row">
<div class="col-md-7 col-md-push-3" style="padding: 5px 24px!important;">
    @include('flash::message')
    @if($errors->any())
        <ul class="alert alert-danger text-center rtl ur fsize26" style="list-style: none;">
            @foreach($errors->all() as $error)
                <li style="color: #000 !important;"> {{ $error }} </li>
            @endforeach
        </ul>
    @endif
</div>

But I get this error: No hint path defined for [flash].

Where my directory structure is given in link Directory Structure When I visit browser, the error is here :

ErrorException in FileViewFinder.php line 112:

No hint path defined for [flash]. (View: E:\Web\xampp\htdocs\wifaq-atropos\resources\views\gazett\errors.blade.php) (View: E:\Web\xampp\htdocs\wifaq-atropos\resources\views\gazett\errors.blade.php) (View: E:\Web\xampp\htdocs\wifaq-atropos\resources\views\gazett\errors.blade.php)

That issue come out when I try to upgrade laravel version from 5.0 to 5.2. Where no error in previous version project 5.0. How to fix it ?


回答1:


I had similar error when using larvael 5.2, here is how i resolved it.

Include this service provider within config/app.php of your project

'providers' => [
        Laracasts\Flash\FlashServiceProvider::class,];

On the same file look for aliases; add this line

'aliases' => [  'Flash' => Laracasts\Flash\Flash::class, ]

The above addition to config/app.php makes @include('flash::message') in my view to work fine




回答2:


And then, if using Laravel 5, include the service provider within config/app.php.

'providers' => [
    'Laracasts\Flash\FlashServiceProvider'
];



回答3:


you can set it manually

if you have your blades views in ...views/flash, that is how you can specify it:

app('flash')->addNamespace('mail', resource_path('views') . '/flash');


来源:https://stackoverflow.com/questions/35575891/laravel-5-2-no-hint-path-defined-for-flash

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!