In which Class are these 'blade functions'

2019-08-27 01:38发布

When you open the cached view inside storage/framework/views/, there are rendered blade views and I can't find these functions:

$__env->startSection('content');

and

$__env->stopSection();

It's probably made with call_user_func() so you can't get to it just by clicking Ctrl+Click, this needs to be answered by someone who really knows the guts of Laravel :)

1条回答
在下西门庆
2楼-- · 2019-08-27 02:14

You can find these methods in the traits used on the Illuminate\View\Factory class. https://github.com/laravel/framework/blob/5.8/src/Illuminate/View/Factory.php#L17-L23

This specific method is actually on the Illuminate\Views\Concerns\ManagesLayouts trait. https://github.com/laravel/framework/blob/5.8/src/Illuminate/View/Concerns/ManagesLayouts.php

Also, in the constructor of that class you will see that $__env is shared with the view. https://github.com/laravel/framework/blob/5.8/src/Illuminate/View/Factory.php#L99

查看更多
登录 后发表回答