我是Eloquent的新手,并且仍然把我的头围绕在它上面,然后我把'where'条款它工作得很好现在我似乎无法让它工作。
$filesRelationship = self::user()->customer->submissions->where('period_timestamp', '=', Input::get('period_timestamp'))->customerfile();
$customerFile = new Customerfile(
array('path' => $savepath, 'document_id' => Input::get('document_id')
)
);
$customerFileResult = $filesRelationship->save($customerFile);
答案 0 :(得分:1)
取决于您的模型的关系(您没有指定它们),但这可能有效:
$filesRelationship = self::user()
->customer()
->submissions()
->where('period_timestamp', '=', Input::get('period_timestamp'))
->customerfile()
->first();