Skip to content

Issue passing data to views #2464

Description

@penguinpower80

I am running v4.0.0-rc.3, and I was generating some excel output from a view. Because of the toolbar debugging, I kept getting the "<!-- DEBUG-VIEW (yadda yadda)" in the output (which is fine since I saw that the toolbar was generating that via the View collector). I disabled (commented out), the Views collector in app\config\Toolbar.php, and everything worked great. However, other stuff started to break.

I have my app set up so there is a primary layout file in views, with many "partial" views that I use. As long as the Views collector is enabled, I can reference variables passed to the layout view within the sub-views, but once I disable it, they are no longer available. I don't really care which way it is, as long as it stays consistent. I'm afraid when I go to production and have the Toolbar disabled, my app will stop working.

Here is an example:

In a controller, I call:

return view('layouts/primary', ['foo'=>'bar']);

in the primary.php view, I have:

[CODE]
echo $foo;
echo view('layouts/blocks/navigation');
[/CODE]

Within the navigation view file, I have:
[CODE]
echo $foo;
[/CODE]

When I execute this with the TOOLBAR VIEWS FILTER ENABLED, I get "barbar", but when I disable the views collector, I get an error indicating that the variable $foo is not defined in the navigation view.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions