當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Course::fill方法代碼示例

本文整理匯總了PHP中app\Course::fill方法的典型用法代碼示例。如果您正苦於以下問題:PHP Course::fill方法的具體用法?PHP Course::fill怎麽用?PHP Course::fill使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\Course的用法示例。


在下文中一共展示了Course::fill方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: store

 public function store(Request $request)
 {
     $inputs = $request->all();
     $course = new Course();
     $course->fill($inputs);
     $course->save();
     return $course->id;
 }
開發者ID:Kangaroos,項目名稱:restart-reserve,代碼行數:8,代碼來源:CourseController.php

示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     //dd($request->all());
     $this->validate($request, ['slug' => 'unique:courses,slug', 'name' => 'required', 'short_description' => 'required', 'description' => 'required', 'date_start' => 'required|date|after:today', 'date_end' => 'required|date|after:date_start', 'min_participants' => 'required|integer', 'max_participants' => 'required|integer', 'price' => 'required|integer']);
     $course = new Course();
     if ($request->hasFile('featured_image')) {
         $featured_image = $course->uploadImage($request->featured_image);
     }
     $course->fill($request->all());
     if (isset($featured_image)) {
         $course->featured_image = $featured_image;
     }
     $course->save();
     Session::flash('flash_message', 'Námskeiðið var vistað');
     return redirect()->back();
 }
開發者ID:dadigu,項目名稱:haskolabru,代碼行數:22,代碼來源:CoursesController.php

示例3: store

 /**
  * Store a newly created resource in storage.
  *
  * @param CreateCourseRequest $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function store(CreateCourseRequest $request)
 {
     $course = new Course();
     $course->fill($request->all());
     $course->user_id = Auth::user()->id;
     if ($request->hasFile('image')) {
         $file = $request->file('image');
         $patch = 'images/courses/';
         $name = $course->id . '.' . $file->getClientOriginalExtension();
         $image = $patch . $name;
         Image::make($file)->fit(650, 360)->save($image);
         $course->image = $image;
     }
     $course->save();
     $message = trans('messages.course_successfully_started');
     Flash::success($message);
     return redirect()->route('teacher.courses.show', $course);
 }
開發者ID:jrafaelca,項目名稱:school_virtual,代碼行數:24,代碼來源:CoursesController.php


注:本文中的app\Course::fill方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。