本文整理匯總了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'));
}