2

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.

1 Answer 1

3

Try to remove space in ['submitButtonText '=>"Redakto"] after submitButtonText:

@include('layouts.create_update_city' , ['submitButtonText'=>"Redakto"])
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.