php - Laravel form echo variable -


i still learning how work laravel. have learned how make form in laravle. have trouble echo variable. want is: want echo variable value of input-field if variable exists, otherwise should echo nothing. form line looks this

  {{form::text(     'league_name',     '@if(isset($varialble) {{$variable}} @else {{$nothing}} @endif)'   )}} 

how can echo variable in form?

i using blade btw.

this right way it:

{!! form::text('league_name', isset($varialble) ? $variable : '') !!} 

if you're using php7, can this:

{!! form::text('league_name', $varialble) ?? '') !!} 

update

to add placeholder, pass in array third parameter. also, want pass class:

{!! form::text('league_name', isset($varialble) ? $variable : '', ['placeholder' => 'my placeholder', 'class' => 'form-control']) !!} 

Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -