Hi,
I've setup a variable to use in my master view file. This works great inside of all my views, unless I'm using a form (currently at the front-page) to post to another route/page. When i hit the submit button and get the redirect to another route, the view::composer seems to skip the variable?
This is what i get when i submit
Undefined variable: NumDatabaseWords (View: C:\xampp\htdocs\pwcheck\app\views\layouts\main.blade.php) (View: C:\xampp\htdocs\pwcheck\app\views\layouts\main.blade.php)
filters.php
App::before(function($request)
{
View::composer('layouts.main', function($view)
{
$test = 'Hello World';
$view->with('NumDatabaseWords', $test);
});
});
in the master view file, i've also got the submit form (same viewfile where the variable is placed) and the form looks like this:
<div class="form_password_application text-center">
{{ Form::open( array('route' => 'check.index')) }}
<input type="text" name="pw_word" placeholder="Check your password..." class="password_check_input" />
<input type="submit" value="ENTER" class="password_check_submit" />
{{ Form::close() }}
</div> <!-- end form_password_application -->
Any suggestions on why i keep getting Undefined variable when i use the POST/Form? This does NOT happen if i don't use the post, then it all works fine..
I got this working after adding another view (the same view that says the variable was missing) inside of the View::composer using an array.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community