Laravel: Passing default variables to view

前端 未结 4 1020
遇见更好的自我
遇见更好的自我 2020-12-29 00:02

In Laravel, we all pass data to our view in pretty much the same way

$data = array(
    \'thundercats\' => \'Hoooooooooooh!\'
);
return View::make(\'myawe         


        
4条回答
  •  没有蜡笔的小新
    2020-12-29 00:54

    @enchance, as an alternative to using '*', as mentioned in your comment, perhaps a View::share would help you too. From the Laravel documentation:

    You may also share a piece of data across all views:

    View::share('name', 'Steve');

    Excerpt is from http://laravel.com/docs/responses

提交回复
热议问题