0

In a Laravel 5.7 controller, this works:

class SearchController extends Controller
{
    return view('test);
}

But this doesn't (the result is a blank page, no html is generated, no error message is shown)

class SearchController extends Controller
{
    $this->show_view();
}

private function show_view()
{
    return view('test);
}

If I add dd('this is a test'); in the private function show_view right before return view('test);, that message is displayed so the show_view method is called properly, but returning the view doesn't work. Why?

1 Answer 1

1

Change $this->show_view(); to return $this->show_view(); and it should work. You're getting a blank page because while you successfully render the view, you don't return it back to Laravel at all.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.