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


PHP Course::create方法代码示例

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


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

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['title' => 'required', 'location' => 'required', 'duration' => 'required', 'details' => 'required']);
     Course::create($request->all());
     Session::flash('message', 'Successfully Stored your Data!');
     return redirect()->back();
 }
开发者ID:minhajCSE,项目名称:teleaus-dev,代码行数:13,代码来源:TrainingController.php

示例2: run

 public function run()
 {
     DB::table('courses')->delete();
     Course::create(['course_code' => 5660, 'course_name' => "Legal", 'course_type' => "Pre-Requisite", 'description' => "This is a core Course"]);
     Course::create(['course_code' => 4665, 'course_name' => "JAVA", 'course_type' => "Track", 'description' => "This is a Track Course"]);
     Course::create(['course_code' => 5656, 'course_name' => "Android", 'course_type' => "Track", 'description' => "This is a Track Course"]);
 }
开发者ID:abhijith444,项目名称:enroll,代码行数:7,代码来源:DatabaseSeeder.php

示例3: run

 public function run()
 {
     DB::table('courses')->delete();
     for ($i = 0; $i < 10; $i++) {
         Course::create(['id' => 'id ' . $i, 'id_1' => 'id_1' . $i, 'id_2' => 'id_2' . $i, 'id_3' => 'id_3' . $i, 'id_4' => 'id_4' . $i, 'name' => 'name' . $i, 'author' => 'author' . $i, 'introduction' => 'introduction' . $i, 'body' => 'body' . $i, 'pay_type' => 'pay_type' . $i, 'score' => 'score' . $i, 'ava_dir' => $i, 'vid_dir' => 'vid_dir' . $i]);
     }
 }
开发者ID:Glee2U,项目名称:laravel,代码行数:7,代码来源:CourseSeeder.php

示例4: store

 public function store(CourseRequest $request)
 {
     $name = $request->name;
     $url = UrlSanitizer::sanitize($name);
     $request["url"] = $url;
     $curso = Course::create($request->all());
     return redirect()->route('stages.index', ['course_url' => $url]);
 }
开发者ID:juanfe190,项目名称:adminclubinnova,代码行数:8,代码来源:CourseController.php

示例5: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(CourseRequest $request)
 {
     $lect = User::where('id', '=', $request['lecturer_id'])->firstOrFail();
     $dept = Department::where('id', '=', $lect->department_id)->firstOrFail();
     $request['department_id'] = $dept->id;
     Course::create($request->all());
     Flash::success('The Course has been created.');
     return redirect()->route('course.index');
 }
开发者ID:omoprodigi,项目名称:Keyword-Matching-Exam,代码行数:15,代码来源:CourseController.php

示例6: store

 public function store(Request $request, $teacher_id)
 {
     $teacher = Teacher::find($teacher_id);
     if ($teacher) {
         $this->validateRequest($request);
         $course = Course::create(['title' => $request->get('title'), 'description' => $request->get('description'), 'value' => $request->get('value'), 'teacher_id' => $teacher_id]);
         return $this->createSuccessResponse("The course with id {$course->id} has been created and associated with the teacher with id {$teacher->id}", 201);
     }
     return $this->createErrorResponse("The teacher with id {$teacher_id} does not exists", 404);
 }
开发者ID:arielcr,项目名称:lumen-api,代码行数:10,代码来源:TeacherCourseController.php

示例7: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     DB::table('courses')->delete();
     $courses = array('Mathematics', 'English', 'Physics', 'Chemistry', 'Biology', 'Further Mathematics', 'Geography', 'Physical Education', 'Literature', 'History', 'Government', 'Fine Arts', 'Social Science', 'Integrated Science', 'Introduction Tecnology', 'Technical Drawing', 'Computer Science');
     $grades = array('JS 1', 'JS 2', 'JS 3', 'SS 1', 'SS 2', 'SS 3', 'A Levels');
     for ($c = 0; $c < count($courses); $c++) {
         Course::create(array('course_name' => $courses[$c]));
     }
 }
开发者ID:purplenimbus,项目名称:Nimbus-SMS,代码行数:15,代码来源:CourseTableSeeder.php

示例8: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store()
 {
     if ($user = Sentinel::check()) {
         $input = Request::all();
         Course::create($input);
         return redirect('/');
     } else {
         return redirect('/');
     }
 }
开发者ID:alexchirea,项目名称:Site-Coupons,代码行数:16,代码来源:CoursesController.php

示例9: store

 public function store(Request $request)
 {
     $rules = ['name' => 'required|unique:grades|min:4|max:255', 'description' => 'min:4|max:255'];
     $messages = ['name.required' => 'Es necesario definir un nombre.', 'name.unique' => 'Los cursos deben tener un nombre único.', 'name.min' => 'Ingrese un nombre adecuado.', 'description.min' => 'Ingrese una descripción adecuada.'];
     $v = Validator::make($request->all(), $rules, $messages);
     if ($v->fails()) {
         return back()->withErrors($v)->withInput();
     }
     Course::create($request->all());
     return back()->with('success', 'Curso registrado exitosamente.');
 }
开发者ID:JCarlosR,项目名称:sistema-academico,代码行数:11,代码来源:CourseController.php

示例10: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(CoursesRequest $request)
 {
     $course = Course::create($request->all());
     $pathToCourse = storage_path() . '/courses/';
     echo $pathToCourse;
     if (!File::isDirectory($pathToCourse)) {
         File::makeDirectory($pathToCourse);
     }
     File::makeDirectory($pathToCourse . $course->slug);
     $course->path_to_material = $pathToCourse . $course->slug;
     $course->save();
     return redirect('courses');
 }
开发者ID:starkbaum,项目名称:sucon,代码行数:19,代码来源:CoursesController.php

示例11: postStore

 public function postStore()
 {
     if (Request::ajax()) {
         $inputData = Input::all();
         $hasExisting = Course::where('name', $inputData['name'])->get();
         if (count($hasExisting) < 1) {
             $newRecord = Course::create($inputData);
             return $newRecord;
         } else {
             return 0;
         }
     }
 }
开发者ID:humbleBeginner,项目名称:unp_guidanceRMS,代码行数:13,代码来源:CourseController.php

示例12: run

 public function run()
 {
     Course::create(['id' => 1, 'name' => 'Cálculo diferencial']);
     Course::create(['id' => 3, 'name' => 'Física mecánica']);
     Course::create(['id' => 4, 'name' => 'Cátedra Francisco José de Caldas']);
     Course::create(['id' => 7, 'name' => 'Cálculo intetegral']);
     Course::create(['id' => 9, 'name' => 'Algebra lineal']);
     Course::create(['id' => 13, 'name' => 'Física II: electromagentismo']);
     Course::create(['id' => 88, 'name' => 'Ecuaciones diferenciales']);
     Course::create(['id' => 1054, 'name' => 'Producción y comprensión de textos I']);
     Course::create(['id' => 1056, 'name' => 'Producción y comprensión de textos II']);
     Course::create(['id' => 1060, 'name' => 'Ciencia tecnología y sociedad']);
     Course::create(['id' => 1072, 'name' => 'Administración ']);
     Course::create(['id' => 1075, 'name' => 'Ética y sociedad']);
     Course::create(['id' => 1213, 'name' => 'Lenguaje de programació']);
     Course::create(['id' => 1330, 'name' => 'Aplicaciones computacionales']);
     Course::create(['id' => 1503, 'name' => 'Contabilidad general']);
     Course::create(['id' => 1507, 'name' => 'Introducción a algoritmos']);
     Course::create(['id' => 1508, 'name' => 'Lógica matemática']);
     Course::create(['id' => 1509, 'name' => 'Fundamentos de organización ']);
     Course::create(['id' => 1510, 'name' => 'Fundamentos de economía']);
     Course::create(['id' => 1511, 'name' => 'TIC\'s en las organizaciones']);
     Course::create(['id' => 1512, 'name' => 'Matemáticas especiales']);
     Course::create(['id' => 1513, 'name' => 'Estructuras de datos']);
     Course::create(['id' => 1514, 'name' => 'Progración orientada a objetos']);
     Course::create(['id' => 1515, 'name' => 'Análisis y métodos numéricos']);
     Course::create(['id' => 1518, 'name' => 'Programación multimnivel']);
     Course::create(['id' => 1519, 'name' => 'Bases de datos']);
     Course::create(['id' => 1524, 'name' => 'Programación avanzada']);
     Course::create(['id' => 1525, 'name' => 'Bases de datos avanzadas']);
     Course::create(['id' => 1526, 'name' => 'Diseño lógico']);
     Course::create(['id' => 1531, 'name' => 'Análisis de sistemas']);
     Course::create(['id' => 1532, 'name' => 'Inteligencia artificial']);
     Course::create(['id' => 1533, 'name' => 'Sistemas operacionales']);
     Course::create(['id' => 1534, 'name' => 'Electiva socio humanística I']);
     Course::create(['id' => 1535, 'name' => 'Transmisión de datos']);
     Course::create(['id' => 1536, 'name' => 'Programación web']);
     Course::create(['id' => 1537, 'name' => 'Taller de investigació']);
     Course::create(['id' => 1538, 'name' => 'Ingeniería de software']);
     Course::create(['id' => 1539, 'name' => 'Arquitectura de computadores']);
     Course::create(['id' => 1540, 'name' => 'Globalizació']);
     Course::create(['id' => 1541, 'name' => 'Fundamentos de telemática']);
     Course::create(['id' => 1542, 'name' => 'Programación por componentes']);
     Course::create(['id' => 1670, 'name' => 'Trabajo de grado I']);
     Course::create(['id' => 7202, 'name' => 'Aplicaciones para internet']);
     Course::create(['id' => 7213, 'name' => 'Teoría de la informació']);
 }
开发者ID:ReyesPedro,项目名称:Proyecto-de-grado,代码行数:47,代码来源:CourseSeeder.php

示例13: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     // validate
     // read more on validation at http://laravel.com/docs/validation
     $rules = array('course_code' => 'required|numeric|unique:courses,course_code', 'course_name' => 'required', 'course_type' => 'required');
     $input = $request->all();
     $validator = Validator::make($input, $rules);
     // process the login
     if ($validator->fails()) {
         return redirect('courses/create')->withErrors($validator)->withInput($input);
     } else {
         // store
         $course = Course::create($input);
         // redirect
         Session::flash('message', 'Successfully created course');
         return redirect('courses');
     }
 }
开发者ID:abhijith444,项目名称:enroll,代码行数:23,代码来源:CourseController.php

示例14: addCourse

 /**
  * Add a new course
  *
  * @param Request $request
  * @return mixed
  */
 public function addCourse(Request $request)
 {
     $this->validate($request, ['courseCode' => 'required|unique:courses', 'courseName' => 'required', 'semNo' => 'required|numeric|min:1', 'lectures' => 'required|numeric|min:0', 'tutorials' => 'required|numeric|min:0', 'practicals' => 'required|numeric|min:0', 'credits' => 'required|numeric|min:1'], ['unique' => 'This course is already present in the database']);
     if ($request->has('departmentElective') && $request->has('openElective')) {
         return redirect()->back()->with('errors', 'A course can not be an open and department elective at same time');
     } else {
         if ($request->has('departmentElective')) {
             $departmentElective = true;
         } else {
             $departmentElective = false;
         }
         if ($request->has('openElective')) {
             $openElective = true;
         } else {
             $openElective = false;
         }
     }
     $course = ['courseCode' => $request['courseCode'], 'dCode' => Auth::guard('departmentStaff')->user()->dCode, 'courseName' => $request['courseName'], 'openElective' => $openElective, 'departmentElective' => $departmentElective, 'semNo' => $request['semNo'], 'lectures' => $request['lectures'], 'tutorials' => $request['tutorials'], 'practicals' => $request['practicals'], 'credits' => $request['credits']];
     // Save the course
     Course::create($course);
     return redirect()->back()->with('status', 'Success');
 }
开发者ID:prateekprshr-nith,项目名称:beautifulCode,代码行数:28,代码来源:HomeController.php

示例15: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     // $this->call(UserTableSeeder::class);
     // $this->call(ClassTableSeeder::class);
     //Optional just to clear table
     // DB::table('answers')->delete();
     // DB::table('questions')->delete();
     // DB::table('classes')->delete();
     // DB::table('users')->delete();
     $student1 = User::create(['name' => 'Scotty Gomez', 'email' => str_random(2) . '@gmail.com', 'password' => bcrypt('secret'), 'type' => 'student']);
     $student2 = User::create(['name' => 'Misha Dowd', 'email' => str_random(2) . '@gmail.com', 'password' => bcrypt('secret'), 'type' => 'student']);
     $lecturer = User::create(['name' => 'Dr. Andre Chen', 'email' => str_random(2) . '@gmail.com', 'password' => bcrypt('secret'), 'type' => 'lecturer']);
     $this->command->info('User Created!');
     $course = Course::create(['name' => 'Math', 'term' => 'Fall2020', 'lecturer_id' => $lecturer->id]);
     $this->command->info('Course Created!');
     $quiz = Quiz::create(['course_id' => $course->id, 'description' => 'A Quiz to Test Your Might!', 'quizTime' => '20', 'startDate' => '10.29.2015', 'endDate' => '10.30.2015']);
     $this->command->info('Quiz Created!');
     //Questions
     $q = Question::create(['prompt' => 'What is the sqare root of 4?', 'difficulty' => 'easy']);
     $q1 = Question::create(['prompt' => 'What is 2 X 3?', 'difficulty' => 'easy']);
     $this->command->info('2 Questions Created!');
     //Answers
     $a = Answer::create(['text' => '6', 'image' => NULL]);
     $a1 = Answer::create(['text' => '2', 'image' => NULL]);
     $a2 = Answer::create(['text' => '6', 'image' => NULL]);
     $a11 = Answer::create(['text' => '5', 'image' => NULL]);
     $this->command->info('All 4 Answers Created!');
     // Adding User to Course
     $course->users()->sync([$student1->id, $student2->id]);
     // Syncing Quiz to Questions
     $quiz->questions()->sync([$q->id, $q1->id]);
     // Syncing (Binding Qustion to Answer)
     $q->answers()->sync([$a->id, $a1->id]);
     $q1->answers()->sync([$a2->id, $a11->id]);
     $this->command->info('Everything Created and Linked!');
     Model::reguard();
 }
开发者ID:sgomez118,项目名称:ASM-Software-Management,代码行数:43,代码来源:DatabaseSeeder.php


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