2017-08-28 3 views
0

私はoctobercmsを初めて使用しています。私は、私の小枝のテンプレートページに関係データを表示する際に問題に直面しています。関係データを示すoctobercms

私のようなレコードをフェッチしています私のページで

:私のパーシャルに

$this['education'] = Education::where('user_id', '=', $logged_in_user->id)->with('transcript')->get(); 

を私のようなレコードを取得することができています:

[ 
    { 
    "id":56, 
    "user_id":6, 
    "created_at":"2017-08-24 07:56:09", 
    "updated_at":"2017-08-25 16:39:17", 
    "school_name":"UCT", 
    "degree_name":"Finance", 
    "majors":"test2", 
    "achievements":"", 
    "transcript":{ 
     "id":20, 
     "disk_name":"59a03695e24c3772338596.png", 
     "file_name":"step1.png", 
     "file_size":68042, 
     "content_type":"image\/png", 
     "title":null, 
     "description":null, 
     "field":"transcript", 
     "sort_order":20, 
     "created_at":"2017-08-25 16:39:17", 
     "updated_at":"2017-08-25 16:39:17", 
     "path":"http:\/\/talentlatch.dev\/storage\/app\/uploads\/public\/59a\/036\/95e\/59a03695e24c3772338596.png", 
     "extension":"png" 
    }, 
    "start_date":"2015-01-01 00:00:00", 
    "end_date":"2017-08-01 00:00:00", 
    "is_fulltime":1 
    } 
] 

を私は上の属性のファイル名を表示しようとしていますページ、私はそれを得ることができません。

+0

あなたは{教育%で%のforeachの項目} を 'のようなforeachのを試してみましたitem.transcript.filename {%ENDFOR%} ' –

答えて

0

教育変数がコレクションである.....

{{ education[0].transcript.file_name }} 

と事前に

{{ education[0]['transcript'].file_name }} 

おかげで、とても

{{ education.first().id }}

あれば試してみてください。私は、ソリューションの下に試してみましたあなたは成功し、次に試してみてください

{{ education.first().transcript.file_name }}