当前位置: 首页>>代码示例>>PHP>>正文


PHP Courses::sections方法代码示例

本文整理汇总了PHP中Courses::sections方法的典型用法代码示例。如果您正苦于以下问题:PHP Courses::sections方法的具体用法?PHP Courses::sections怎么用?PHP Courses::sections使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Courses的用法示例。


在下文中一共展示了Courses::sections方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: postCreate

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function postCreate()
 {
     /*
     		Validator::make(
     array(
     	'title' => Input::get('title'),
     	'description' => Input::get('description'),
     	'content' => Input::get('content'),
     	'program' => Input::get('program'),
     	'address' => Input::get('address'),
     	'company_id' => Input::get('company_id'),
     	'event_id' => Input::get('event_id'),
     	'category_id' => Input::get('category_id'),
     	'start' => date("Y-m-d", Input::get('start')),
     	'end' => date("Y-m-d", Input::get('end'))
     	),
     array(
     	'title' => 'required',
     	'description' => 'required',
     	'content' => 'required',
     	'program' => 'required',
     	'address' => 'required',
     	'company_id' => 'required|integer',
     	'event_id' => 'required|integer',
     	'category_id' => 'required|integer',
     	'start' => 'required|date',
     	'end' => 'required|date',
     	)
     );
     */
     $header = Input::file('header');
     $image = Input::file('image');
     $validator = Validator::make(array('header' => $header, 'image' => $image), array('header' => 'mimes:png,jpeg,gif', 'image' => 'mimes:png,jpeg,gif'), array('mimes' => 'Tipo de imagen inválido, solo se admite los formatos PNG, JPEG, y GIF'));
     if ($validator->fails()) {
         return Redirect::to($this->route . '/create')->with('msg_succes', Lang::get('messages.companies_create_img_err'));
     } else {
         if ($header != "") {
             $headerfilename = $this->uploadHeader($header);
         } else {
             $headerfilename = "";
         }
         if ($image != "") {
             $imagefilename = $this->uploadCourseImage($image);
         } else {
             $imagefilename = "";
         }
         $course = new Courses();
         $course->title = Input::get('title');
         $course->description = Input::get('description');
         $course->header = $headerfilename;
         $course->image = $imagefilename;
         /*
         $course->description = Input::get('description');
         $course->inscription = Input::get('inscription');
         $course->associates_payment = Input::get('associates_payment');
         $course->participants_payment = Input::get('participants_payment');
         $course->associates_message = Input::get('associates_message');
         $course->program = Input::get('program');
         $course->participants_message = Input::get('participants_message');
         */
         $course->category_id = Input::get('category_id');
         $course->company_id = Input::get('company_id');
         $course->event_id = Input::get('event_id');
         $course->type = Input::get('type');
         $course->route = Input::get('route');
         $course->min = Input::get('min');
         $course->max = Input::get('max');
         $course->min_message = Input::get('min_message');
         $course->max_message = Input::get('max_message');
         $course->address = Input::get('address');
         $course->start = date("Y-m-d", strtotime(Input::get('start')));
         $course->end = date("Y-m-d", strtotime(Input::get('end')));
         if ($course->save()) {
             /*$teachers = Input::get('teachers');
             		$course->teachers()->sync($teachers);
             		$promotioners = Input::get('promotioners');
             		$course->promotioners()->sync($promotioners);
             		$supporters = Input::get('supporters');
             		$course->supporters()->sync($supporters);*/
             $sections = Input::get('section');
             $course->sections()->sync($sections);
             return Redirect::to($this->route)->with('msg_success', Lang::get('messages.companies_create', array('title' => $course->title)));
         } else {
             return Redirect::to($this->route)->with('msg_error', Lang::get('messages.companies_create_err', array('title' => $course->title)));
         }
     }
 }
开发者ID:nagyist,项目名称:abge,代码行数:92,代码来源:CourseController.php


注:本文中的Courses::sections方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。