Reputation: 23
I have two view files, city_update and create_update_city and a helpers.php file which i have configured and it works fine.
city_update contains a form which at some point includes create_update_city which is used to call the functions declared in the helpers.php.
The form has a button and i need the button text sting to be passed through an array when i include create_update_city but i get a error "Undefined variable: submitButtonText in create_update_city.blade.php". I think it happens because the helpers.php is called before the include and it has no value for the submitButtonText variable but i cant think of a way to solve this.
city_update.blade.php - contains :
{{ Form::model($city , array('action'=>'CityController@create','class'=>'form-horizontal','method'=>'PATCH')) }}
@include('layouts.create_update_city' , ['submitButtonText '=>"Redakto"])
{{ Form::close() }}
create_update_city.blade.php - contains :
{!!
submit([
"name" => $submitButtonText ,
"class" => "btn btn-primary"
])
!!}
helpers.php file has a submit functions which contains :
Form::submit( $input['name'] , array('class' => $input['class'] ))
Any help on this would be highly appreciated.
Upvotes: 2
Views: 529
Reputation: 163768
Try to remove space in ['submitButtonText '=>"Redakto"]
after submitButtonText
:
@include('layouts.create_update_city' , ['submitButtonText'=>"Redakto"])
Upvotes: 3