Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use domain.com/health/panel, Undefined variable: health #133

Open
poor-bob opened this issue Nov 6, 2018 · 0 comments
Open

Can't use domain.com/health/panel, Undefined variable: health #133

poor-bob opened this issue Nov 6, 2018 · 0 comments

Comments

@poor-bob
Copy link

poor-bob commented Nov 6, 2018

PHP version: 7.2.11
Laravel version: 5.7.*

I receive the following error when attempting to access /health/panel:

Method Illuminate\View\View::__toString() must not throw an exception, caught ErrorException: Undefined variable: health (View: /mnt/c/Users/{removed}/Desktop/dev/laravel/resources/views/vendor/pragmarx/health/default/panel.blade.php)

This is the controller code that's failing

    /**
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     * @throws \Exception
     */
    public function panel()
    {
        $this->healthService->setAction('panel');

        return response((string) view(config('health.views.panel'))->with('laravel', ['health' => config('health')]));
    }

This is the view code that fails in panel.blade.php

                    @foreach($health as $item)
                        @include(
                            config('health.views.partials.well'),
                            [
                                'itemName' => $item['name'],
                                'itemHealth' => $item['health']['healthy'],
                                'itemMessage' => $item['health']['message'],
                                'columnSize' => $item['columnSize'] ?: $item['column_size']
                            ]
                        )
                    @endforeach

When I dd(config('health')); it returns the expected json object, but for some reason $health is undefined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@poor-bob and others