本文整理汇总了PHP中app\Language::whereSectionId方法的典型用法代码示例。如果您正苦于以下问题:PHP Language::whereSectionId方法的具体用法?PHP Language::whereSectionId怎么用?PHP Language::whereSectionId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Language
的用法示例。
在下文中一共展示了Language::whereSectionId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
/**
* Display the specified resource.
*
* @param Request $request
* @param CV $cv
* @return \Illuminate\Http\Response
*/
public function show(Request $request, CV $cv)
{
// Get the cv sections.
$sections = $cv->sections()->get();
// Build empty subsections.
$workSection = array();
$languageSection = array();
$educationSection = array();
$hobbySection = array();
$skillSection = array();
// For each section, determine it's type, and append it's data to the corresponding subsection.
foreach ($sections as $section) {
$w = Work::whereSectionId($section->id)->get(['name', 'location', 'title', 'description', 'start_date', 'end_date'])->toArray();
$l = Language::whereSectionId($section->id)->get(['name', 'level', 'creditation'])->toArray();
$e = Education::whereSectionId($section->id)->get(['name', 'location', 'title', 'description', 'start_date', 'end_date'])->toArray();
$h = Hobby::whereSectionId($section->id)->get(['text'])->toArray();
$s = Skill::whereSectionId($section->id)->get(['name', 'level', 'description'])->toArray();
if (count($w) != 0) {
array_push($workSection, $w);
}
if (count($l) != 0) {
array_push($languageSection, $l);
}
if (count($e) != 0) {
array_push($educationSection, $e);
}
if (count($h) != 0) {
array_push($hobbySection, $h);
}
if (count($s) != 0) {
array_push($skillSection, $s);
}
}
return view('pages.cvs.show', ['cv' => $cv, 'user' => $request->user(), 'workSection' => $workSection, 'languageSection' => $languageSection, 'educationSection' => $educationSection, 'hobbySection' => $hobbySection, 'skillSection' => $skillSection]);
}