나는 다음과 같은 경로가 있습니다모델 관계 및 노선들은 모델 ID를 얻을
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를 정의하는 방법
감사합니다
루프 내 if 문에서 메모를 어떻게 필터링합니까? @if (는 isset ($ 노트 -> 제목)! = 'shorttext') 경로에서
@else
<p> {{ $note->text }} </p>
@endif
@endforeach
내가 알기로 : 정의되지 않은 변수 : 대상 – dflow