本文整理汇总了PHP中Courses::checkWhetherCourseAdded方法的典型用法代码示例。如果您正苦于以下问题:PHP Courses::checkWhetherCourseAdded方法的具体用法?PHP Courses::checkWhetherCourseAdded怎么用?PHP Courses::checkWhetherCourseAdded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Courses
的用法示例。
在下文中一共展示了Courses::checkWhetherCourseAdded方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addCourses
public function addCourses()
{
$currentPage = "COURSES";
$mainMenu = "COURSES_MAIN";
$inputs = Input::all();
if (isset($inputs['courseName']) || isset($inputs['masterCourseList'])) {
$courses = new Courses();
if (isset($inputs['masterCourseList'])) {
$inputs['masterCourse'] = $inputs['masterCourseList'];
$courseName = json_decode(CoursesMaster::select('slug', 'course_name')->where("id", "=", $inputs['masterCourse'])->get());
$inputs['courseName'] = $courseName[0]->course_name;
$inputs['slug'] = $courseName[0]->slug;
}
if (!$courses->fill($inputs)->validate()) {
return Redirect::back()->withInput()->withErrors($courses->errors());
} else {
$courseExistence = Courses::checkWhetherCourseAdded(Session::get('franchiseId'), $inputs['masterCourse']);
if ($courseExistence == 0) {
if (Courses::addCourse($inputs)) {
Session::flash('msg', "Course added successfully.");
} else {
Session::flash('warning', "Sorry, Course Could not be added at the moment.");
}
} elseif ($courseExistence > 0) {
Session::flash('error', "Sorry, Course already added to your franchise.");
}
if (isset($inputs['masterCourseList'])) {
return Redirect::to('/courses/name_list');
}
return Redirect::to('/courses/add');
}
}
$courseList = CoursesMaster::getCoursesList();
$courses = Courses::getFranchiseCourses(Session::get('franchiseId'));
return View::make('pages.courses.addCourse', compact('courseList', 'courses', 'currentPage', 'mainMenu'));
}