Код: Выделить всё
Document->hasMany('Page')
Page->belongsTo('Document')->hasMany('Item')
Item->belongsTo('Page')
Код: Выделить всё
$layout = Document::with('Page.Item')->where('status', '=', 1)->get();
Код: Выделить всё
array(
[0]array(
[document-title]
[pages]array(
[page-subject]
[items]array(
[item-content]
))))
Код: Выделить всё
array(
[0]array(
[item-content]
[pages-subject]
[document-title]
))
Код: Выделить всё
foreach($document as $d){
foreach($d['pages'] as $p{
$pStuff = array($p['subject']);
foreach($p['items'] as $i{
$iStuff = array($i['content']);
$input = array_merge($iStuff, $pStuff);
$data[] = $input;
}}}
Будем благодарны за любую помощь, спасибо!
-JB
Подробнее здесь: https://stackoverflow.com/questions/283 ... nto-parent
Мобильная версия