當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Sections::findByPosition方法代碼示例

本文整理匯總了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));
         }
     }
 }
開發者ID:nagyist,項目名稱:abge,代碼行數:23,代碼來源:SectionController.php

示例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);
     }
 }
開發者ID:nagyist,項目名稱:abge,代碼行數:43,代碼來源:FrontendCourseController.php


注:本文中的Sections::findByPosition方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。