у меня есть следующий маршрут:модель отношений и пути получить Идентификатор модели
Route::get('notes/main', function(){
$destinations = Destination::where('show', '=','1')->get();
$notes = Destination::find($destination->id)->notes()->get();
return View::make('notes.main')
->with('destinations', $destinations);
});
// в модели отношений:
<?php
class Destination extends Eloquent {
public function notes()
{
return $this->has_many('Note');
}
}
<?php
class Note extends Eloquent
{
public function destination()
{
return $this->belongs_to('Destination');
}
}
// Просмотр:
@foreach($destinations as $destination)
{{ $destination->name}}<br>
{ $notes->destination->text }} // this isn't echoed
@endforeach
что правильно способ фильтрации этого и определить $ destination-> id
thanks
Как бы фильтровать заметки в инструкции if внутри цикла? @if (Исеть ($ Примечание-> название)! = 'Shorttext')
@else
<p> {{ $note->text }} </p>
@endif
@endforeach
Я получаю: Неопределенная переменная: назначение – dflow