本文整理汇总了PHP中app\Course类的典型用法代码示例。如果您正苦于以下问题:PHP Course类的具体用法?PHP Course怎么用?PHP Course使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Course类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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());
$course = new Course();
$course->course_name = $request->input('course_name');
$course->course_instructor = $request->input('course_instructor');
$course->semester_id = $request->input('semester_id');
$course->course_time_id = $request->input('course_time_id');
$course->course_location = $request->input('course_location');
$course->save();
return redirect('courses');
}
示例3: new_courses
public function new_courses()
{
Course::where('offered_this_semester', true)->update(['offered_this_semester' => false]);
$courseSeeder = new \CourseTableSeeder();
$courseSeeder->run();
return redirect(route('course.index'));
}
示例4: destroy
public function destroy($id)
{
$courses = Course::find($id);
$courses->schedules()->delete();
$courses->delete();
return response()->json(['id' => $id]);
}
示例5: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
factory(User::class, 50)->create()->each(function ($user) {
// store 10 rounds per user
for ($i = 0; $i < 10; $i++) {
// pick a random course to play on
$course = Course::orderByRaw("random()")->first();
// pick a random tee set on that course
$teeSet = TeeSet::orderByRaw("random()")->where('course_id', $course->id)->first();
$holes = $course->holes;
$scores = [];
// each round has 18 scores
for ($j = 0; $j < 18; $j++) {
$scores[] = factory(Score::class)->make(['hole_id' => $holes[$j]->id]);
}
$round = factory(Round::class)->make(['tee_set_id' => $teeSet->id]);
$round = $user->rounds()->save($round);
$round->scores()->saveMany($scores);
}
$followed = [$user->id];
// follow 10 random users
for ($i = 0; $i < 10; $i++) {
// pick a random user, that is not the current user and is not already followed
$userToFollow = User::orderByRaw("random()")->whereNotIn('users.id', $followed)->first();
$user->following()->attach($userToFollow);
$followed[] = $userToFollow->id;
}
});
}
示例6: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$teacher = User::find(Auth::user()->id);
$resourceTypes = Resource_type::all();
$courses = $crs = Course::orderBy('affiliateId', 'DESC')->orderBy('streamId', 'DESC')->orderBy('levelId', 'DESC')->get();
return view('teacher')->with('teacher', $teacher)->with('resourceTypes', $resourceTypes)->with('courses', $courses);
}
示例7: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
$trainees = Registration::lists('english_name', 'id');
$courses = Course::lists('course_name', 'id');
$data = TraineeCourse::whereId($id)->firstOrFail();
return view('traineeCourse.edit', compact('trainees', 'courses', 'data'));
}
示例8: create
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create($course_url, $stage_url)
{
$curso = Course::where('url', $course_url)->first();
$etapa = Stage::where('url', $stage_url)->where('course_id', $curso->id)->first();
$tiposItem = ItemType::all()->pluck('name', 'id');
return view('pages.items.create', ['curso' => $curso, 'etapa' => $etapa, 'tiposItem' => $tiposItem]);
}
示例9: getUnavailableGpAsgs
public function getUnavailableGpAsgs($courseId)
{
$gpAsgs = Course::find($courseId)->gpAsgs;
return $gpAsgs->filter(function ($gpAsg) {
return !$this->testGpAsgAvailable($gpAsg);
});
}
示例10: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
$course = Course::findOrFail($id);
$course->delete();
Session::flash('message', 'Successfully Deleted your Data!');
return redirect()->back();
}
示例11: show
public function show($slug)
{
$page = Page::where('slug', $slug)->first();
$courses = Course::published()->hasCategory()->orderBy('created_at', 'desc')->take(4)->get();
$articles = Article::published()->orderBy('published_at', 'desc')->take(2)->get();
return view('pages.show', ['page' => $page, 'latest_courses' => $courses, 'latest_articles' => $articles]);
}
示例12: index
/**
* Show the application dashboard.
*
* @return Response
*/
public function index()
{
// Get an array of courses which this instructor has created
$courses = Course::where('instructor_id', '=', Auth::id())->get();
// Render the view, passing the courses array into it
return view('home')->with('courses', $courses);
}
示例13: 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"]);
}
示例14: getUnavailableWithinGpAsgs
public function getUnavailableWithinGpAsgs($courseId)
{
$withinGpAsgs = Course::find($courseId)->withinGpAsgs;
return $withinGpAsgs->filter(function ($withinGpAsg) {
return !$this->testWithinGpAsgAvailable($withinGpAsg);
});
}
示例15: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
$trainer_course = TrainerCourse::whereid($id)->firstOrfail();
$trainers = DB::table('users')->leftjoin('role_user', 'users.id', '=', 'role_user.user_id')->where('role_user.role_id', 2)->select('users.id as id', 'users.name as name')->lists('name', 'id');
$courses = Course::lists('course_name', 'id');
return view('TrainerCoursesRelation.edit', compact('trainer_course', 'trainers', 'courses'));
}