本文整理匯總了PHP中Sections::findByPosition方法的典型用法代碼示例。如果您正苦於以下問題:PHP Sections::findByPosition方法的具體用法?PHP Sections::findByPosition怎麽用?PHP Sections::findByPosition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Sections
的用法示例。
在下文中一共展示了Sections::findByPosition方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getDown
public function getDown($id = '')
{
if ($id == '') {
return Redirect::to($this->route);
} else {
$section = Sections::find($id);
$upper = Sections::findByPosition($section->order + 1);
if ($upper) {
$section->order = $section->order + 1;
$section->save();
$upper->order = $upper->order - 1;
$upper->save();
return Redirect::to($this->route)->with('msg_success', Lang::get('messages.sections_update'));
} else {
return Redirect::to($this->route)->with('msg_error', Lang::get('messages.sections_display_err'));
}
if (!$section) {
return Redirect::to($this->route)->with('msg_error', Lang::get('messages.sections_display_err'));
} else {
return View::make('backend.sections.update', array('section' => $section));
}
}
}
示例2: getCourseContent
public static function getCourseContent($id, $course, $idContent)
{
$contents = self::getOrderedContent($course->coursesections);
// dd($contents);
$array = array('course' => $course, 'contents' => $contents);
if ($idContent != '') {
$array['section'] = CoursesSection::find($idContent);
switch ($array['section']->section->type) {
case 'section':
return View::make('frontend.courses.content')->with($array);
break;
case 'teachers':
$array['teachers'] = $course->teachers;
return View::make('frontend.courses.teachers')->with($array);
break;
case 'promotioners':
$array['promotioners'] = $course->promotioners;
return View::make('frontend.courses.promotioners')->with($array);
break;
case 'helpers':
$array['helpers'] = $course->helpers;
return View::make('frontend.courses.helpers')->with($array);
break;
case 'inscriptions':
return View::make('frontend.courses.inscription')->with($array);
break;
case 'works':
return View::make('frontend.courses.works')->with($array);
break;
case 'supporters':
$array['supporters'] = $course->supporters;
return View::make('frontend.courses.supporters')->with($array);
break;
default:
return View::make('frontend.courses.content')->with($array);
break;
}
} else {
$section = Sections::findByPosition(1);
$array['section'] = $contents[0];
return View::make('frontend.courses.content')->with($array);
}
}