I'm developing a project of "borrowing" things from a company and I'm locked in a key module. So I do not have much experience in laravel, so I came across the following situation:
Database - I have a LOCAL table that correlates with multiple keys. (a location needs one or more keys to be opened) - I have a table TYPE_CHAVE . (eg standard type 1, standard 2 and etc.) - I have a LOCAL_TIPO_CHAVE table linking LOCAL to KEY_TYPE
So far so good, ready all the right places, the problem happens when I will relate the keys to this location.
Controller (LocalController)
public function index()
{
$localchaves = \App\LocalChave::orderBy('id_local');
$locais = \App\Local::orderBy('id_local')->get();
return view('site.index', compact('locais', 'localchaves '));
}
View (index.blade.php
...
@if($locais)
@foreach($locais as $local)
{{$strchave = ""}}
{{$chaveslocal = $localchaves->where('id_local', '=', $local->id_local)->get()}};
@foreach($chaveslocal as $chavelocal)
{{$strchave = '<br>' + $chavelocal->tipochave->descricao}};
@endforeach
@endforeach
@endif
...
<a href='/local/chave' onMouseOver="toolTip('Clique para Editar as Chaves {{$strchave}}')" onMouseOut="toolTip()">Chave(s)</a>
...
The variable does not receive the correct value and the values inside the {{}} keys appear as an echo.
Ex. in the middle of the page appears
$ strchave=""; [{"key_id": "1", "created_at": "2016-06-16 17:32:00", "updated_at": "2016-06-16 17:32:00", "key_id": "1 "," local_id ":" 1 "}]; $ strchave = ' '+ Mul-t-lock M1;
The value I want the $ strchave variable to have is, for example
'<br> Padrão 1 <br> Padrão 2'
I tried searching in various ways on google, but I'm not finding the right terms for this search.