laravel 5.2在刀片模板中扩展break-and-continue指令时出错


laravel 5.2 error in extending break and continue directive in blade template

我想在我的刀片模板中使用@break和@continue。我试着扩展它这是AppServiceProvider

public function boot()
    {
       Blade::directive('datetime', function($expression) {
            return "<?php echo with{$expression}->format('m/d/Y H:i'); ?>";
        });
    }

但当我刷新我的项目时,我得到了这个错误

FatalErrorException in AppServiceProvider.php line 16:
Class 'App'Providers'Blade' not found

请任何人帮我

我敢打赌,在文件的开头已经定义了一个命名空间。如果您没有用use语句指定Blade类的命名空间,它会假设Blade的命名空间与当前文件的(App'Providers)相同。

最简单的解决方案是:'放在Blade::directive之前,使其成为'Blade::directive