当前位置: 首页>>代码示例>>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;未经允许,请勿转载。