2016-10-28 4 views
0

Ich bin Junior-Entwickler und habe mit einem solchen Problem stucked: Laravel bringt mir einen Fehler zurück: „Die Verwendung von nicht definierten konstanten Eingangs - angenommen‚Eingang‘“ Und ich verstehe nicht, warum: Diese Variable ist IN JavaScript-Code.Verwendung von undefinierte Konstante (Eingang) Laravel 5

Hier ist sie:

 <div class="form-group"> 
     {!! Form::label('pac-input', 'Адрес') !!} 
     {!! Form::text('pac-input', $meta ? $meta->pac-input:old('pac-input', null), ['class' => 'form-control', 'placeholder' => 'Введите адрес']) !!} 
    </div> 

Mein Eingang

var input = (
       document.getElementById('pac-input')); 

       var autocomplete = new google.maps.places.Autocomplete(input); 
       autocomplete.bindTo('bounds', map); 

Mein JavaScript-Code (google.maps.api3)

bekam auch eine Frage: in der Quelle ein Kommentar war nach

var input = /** @type {!HTMLInputElement} */(
    document.getElementById('pac-input')); 

Welche Art von HTMLInputElement möchte dieser?

Danke!

Antwort

0

Sie haben einen Tippfehler in Ihrem Code.

ersetzen

$meta->pac-input 

mit

$meta->pac->input 
0

Die hier Täter -

Laravel Klinge Templating Ihre Variable $meta->pac-input als $meta->pac und -input statt $meta->pac-input als einzelne Variable sieht ist.

So möchten Sie könnten Sie Code in sich ändern,

<div class="form-group"> 
    {!! Form::label('pac_input', 'Адрес') !!} 
    {!! Form::text('pac_input', $meta ? $meta->pac_input:old('pac_input', null), ['class' => 'form-control', 'id' => 'pac_input' 'placeholder' => 'Введите адрес']) !!} 
</div> 
Verwandte Themen