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


PHP Course::where方法代码示例

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


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

示例1: store

 /**
  * @POST("/purchase", as="purchase.store")
  * @param Purchase $purchase
  * @param Request $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function store(Purchase $purchase, Request $request)
 {
     $data = $request->all();
     if ((int) $data['amount'] <= 0) {
         return redirect()->route('profile.index')->with('message', 'Некорректная сумма вклада!');
     }
     $type1 = TypePurchase::where('id', 1)->first();
     $type2 = TypePurchase::where('id', 2)->first();
     $type3 = TypePurchase::where('id', 3)->first();
     $user = User::where('id', $request->input('user_id'))->first();
     $course = Course::where('currency_id', $request->input('currency_id'))->first();
     $data['course'] = $course->course_purchase;
     if ($request->input('status_trust') === 'true') {
         $data['status_trust'] = 1;
         $purchase->fill($data);
         $purchase->type()->associate($type2);
         $purchase->user()->associate($user);
         $purchase->course()->associate($course);
         $purchase->save();
     } elseif (!$request->input('total')) {
         $data['total'] = $request->input('amount');
         $purchase->fill($data);
         $purchase->type()->associate($type3);
         $purchase->user()->associate($user);
         $purchase->course()->associate($course);
         $purchase->save();
     } else {
         $purchase->fill($data);
         $purchase->type()->associate($type1);
         $purchase->user()->associate($user);
         $purchase->course()->associate($course);
         $purchase->save();
     }
     return redirect()->route('profile.index')->with('message', 'Заявка сделана! Свои оперции Вы можете
     посмотреть в разделе "Мои операции"');
 }
开发者ID:lyovkin,项目名称:elcoinbank,代码行数:42,代码来源:PurchaseController.php

示例2: universityCourses

 public function universityCourses($uni_id)
 {
     $courses = Course::where('university_id', $uni_id)->get()->toArray();
     if ($courses) {
         $message = 'Success';
         return Response()->json(ResponseManager::getResult($courses, 10, $message));
     } else {
         $message = 'No Course added';
         return Response()->json(ResponseManager::getError('', 10, $message));
     }
 }
开发者ID:GaurangGhinaiya,项目名称:Laravel-Angular-Demo,代码行数:11,代码来源:UniversityController.php

示例3: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $delete = Course::where('id', $id)->delete();
     if ($delete) {
         $message = 'Detele successfully';
         return Response()->json(ResponseManager::getResult($delete, 10, $message));
     } else {
         $message = 'Error while deleting';
         return Response()->json(ResponseManager::getError('', 10, $message));
     }
 }
开发者ID:GaurangGhinaiya,项目名称:Laravel-Angular-Demo,代码行数:17,代码来源:CourseController.php

示例4: search

 /**
  * Search in courses.
  *
  * @param  string  $search
  * @return Response
  */
 public function search($id, $search)
 {
     $courses = Course::where('name', 'like', '%' . $search . '%')->where('college_id', $id)->take(6)->get();
     return response()->json($courses);
 }
开发者ID:jmoreirafilho,项目名称:SharingTests,代码行数:11,代码来源:CourseController.php

示例5: viewCourseByLecturer

 /**
  * Show all course only taught by this lecturer on current semester
  * @return $this
  */
 public function viewCourseByLecturer()
 {
     //get current user
     $user = Auth::user();
     //get the mapping for lecturer
     $kode_dosen = $user->lecturer->Kode_Dosen;
     $id_semester = Kalender::getRunningSemester()->id;
     $courses = Course::where('Kode_Dosen', $kode_dosen)->where('id_semester', $id_semester)->get();
     return view('lecturers.showcourse')->with('Courses', $courses);
 }
开发者ID:mekas,项目名称:absenv2,代码行数:14,代码来源:MatkulController.php

示例6: checkSectionId

 protected function checkSectionId($validator)
 {
     $seksi = $validator->getData()['kode_seksi'];
     $id_semester = Kalender::getRunningSemester()->id;
     $instance = Course::where('seksi', $seksi)->where('id_semester', $id_semester)->get();
     if (count($instance) == 0) {
         return true;
     }
     return false;
     //the precondition for being add, section id must not exist for current user or has been registered
 }
开发者ID:mekas,项目名称:absenv2,代码行数:11,代码来源:StudentController.php


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