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


PHP Course::user方法代码示例

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


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

示例1: createBill

 private function createBill(Course $course)
 {
     $user = $course->user()->getResults();
     // $name = 'Fritz';
     // $lastname ='Hauser';
     // $courseName ='Parties für Introvertierte';
     $id = 1;
     $date = date('m.d.Y');
     // $maxPart=34;
     $pdf = new FPDI();
     $disk = Storage::disk('local');
     $templatePath = base_path() . '/resources/assets/pdf/bill_template.pdf';
     $filename = $this->generateFileName();
     # set fonts and whatnot
     $pdf->AddFont('Calibri', '', 'calibri.php');
     $pdf->AddFont('Calibri', 'B', 'calibrib.php');
     $pdf->SetFont('Calibri', '', 11);
     # load template PDF
     $pdf->AddPage();
     $pdf->setSourceFile($templatePath);
     $tplIdx = $pdf->importPage(1);
     $pdf->useTemplate($tplIdx);
     #put text into PDF
     $pdf->SetXY(23, 55);
     $pdf->Write(0, $this->sanitizeString($user->firstName));
     $pdf->SetXY(23, 60);
     $pdf->Write(0, $this->sanitizeString($user->lastName));
     $pdf->SetXY(23, 65);
     $pdf->Write(0, $this->sanitizeString($user->address));
     $pdf->SetXY(23, 70);
     $pdf->Write(0, $this->sanitizeString($user->zip));
     $pdf->SetXY(33, 70);
     $pdf->Write(0, $this->sanitizeString($user->city));
     $pdf->SetXY(23, 75);
     $pdf->Write(0, $this->sanitizeString($user->country));
     $pdf->SetXY(55, 101);
     $pdf->Write(0, $this->sanitizeString(mt_rand(1232, 3545345)));
     $pdf->SetXY(55, 106);
     $pdf->Write(0, $this->sanitizeString(utf8_decode($date)));
     $pdf->SetXY(26, 124);
     $pdf->Write(0, $this->sanitizeString($course->courseName));
     $pdf->SetXY(32, 128.2);
     $pdf->Write(0, $course->id);
     $pdf->SetXY(70, 124);
     $pdf->Write(0, utf8_decode($date));
     $pdf->SetXY(110, 124);
     $pdf->Write(0, $course->participantNum);
     $pdf->SetXY(165, 124);
     $pdf->Write(0, $course->participantNum);
     $pdf->SetXY(165, 138);
     $pdf->SetFont('Calibri', 'B', 11);
     $pdf->Write(0, $course->participantNum);
     $output = $pdf->Output('', 's');
     $disk->put($filename, $output);
     return $filename;
 }
开发者ID:salvomulas,项目名称:angryproton,代码行数:56,代码来源:Bill.php

示例2: storeORUpdate

 /**
  * @param $id
  * @return \Illuminate\Http\RedirectResponse
  *
  */
 private function storeORUpdate(Request $request, Course $course)
 {
     $this->validate($request, ['institution' => 'required|integer', 'courseName' => 'required|max:64', 'description' => 'required|min:10', 'price' => 'numeric|required|min:0|max:9999', 'startDate' => 'required|date', 'duration' => 'required|min:0|max:480|integer', 'participantNum' => 'required|min:1|max:50|Integer']);
     $institution = Institution::find($request->institution);
     #TODO validate the institute here.
     #$this->validator->after(function($validator) {
     #    if ($this->somethingElseIsInvalid()) {
     #        $validator->errors()->add('field', 'Something is wrong with this field!');
     #    }
     #});
     $course->institution()->associate($institution);
     $course->courseName = $request->courseName;
     $course->description = $request->description;
     $course->price = $request->price;
     $course->startDate = $request->startDate;
     $course->duration = $request->duration;
     $course->participantNum = $request->participantNum;
     $course->user()->associate(Auth::user());
     if ($course->save()) {
         \Session::flash('flash_message', "Der Kurs wurde erfolgreich gespeichert");
         \Session::flash('flash_message_type', "success");
         return redirect()->action('CourseController@show', [$course->id]);
     } else {
         return Redirect::back()->withError("Der Kurs konnte leider nicht gespeichert werden.")->withInput();
     }
 }
开发者ID:salvomulas,项目名称:angryproton,代码行数:31,代码来源:CourseController.php


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