Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
272 views
in Technique[技术] by (71.8m points)

laravel5.2 如何在中间件中向视图传递变量?

需求
1 很多页面需要根据权限来显示相应前端组件
2 现在准备写一个控制器之后执行的中间件,在这里把该用户拥有的权限传递给视图,然后视图根据权限显示相应组件

问题是:现在不知道如何把控制器之后执行的中间件变量传递到视图中,求解?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
view()->share('user', []);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...