Laravel 5.2:没有为 [flash] 定义提示路径

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35575891/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 13:17:06  来源:igfitidea点击:

Laravel 5.2 : No hint path defined for [flash]

laravellaravel-5.2

提问by saeed ahmed

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

安装"laracasts/flash": "^1.3"包后,我试图制作一个视图,这是我的代码:

@include('gazett.errors')

Where in gazett.errorsblade.php file code is here :

gazett.errorsBlade.php 文件中的代码在哪里:

<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].

但是我收到这个错误:没有为 [flash] 定义提示路径。

Where my directory structure is given in link Directory StructureWhen 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)

没有为 [flash] 定义提示路径。(查看: E:\Web\xampp\htdocs\wifaq-atropos\resources\views\gazett\errors.blade.php) (查看: E:\Web\xampp\htdocs\wifaq-atropos\resources\views\gazett\ errors.blade.php)(查看: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 ?

当我尝试将 Laravel 版本从 5.0 升级到 5.2 时出现了这个问题。在以前的版本项目 5.0 中没有错误的地方。如何解决?

回答by Seunope

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

我在使用 larvael 5.2 时遇到了类似的错误,这是我解决的方法。

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

在你的项目的 config/app.php 中包含这个服务提供者

'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

以上对 config/app.php 的添加使我认为 @include('flash::message') 可以正常工作

回答by S. Wiwat

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

然后,如果使用 Laravel 5,请将服务提供者包含在 config/app.php 中。

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

回答by Yevgeniy Afanasyev

you can set it manually

你可以手动设置

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

如果您在 ...views/flash 中有刀片视图,那么您可以指定它:

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