本文整理汇总了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)));
}
}
}