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; }
/** * 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'); }
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')); }
public function destroy($id) { $courses = Course::find($id); $courses->schedules()->delete(); $courses->delete(); return response()->json(['id' => $id]); }
/** * 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; } }); }
/** * 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); }
/** * 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')); }
/** * 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]); }
public function getUnavailableGpAsgs($courseId) { $gpAsgs = Course::find($courseId)->gpAsgs; return $gpAsgs->filter(function ($gpAsg) { return !$this->testGpAsgAvailable($gpAsg); }); }
/** * 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(); }
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]); }
/** * 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); }
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"]); }
public function getUnavailableWithinGpAsgs($courseId) { $withinGpAsgs = Course::find($courseId)->withinGpAsgs; return $withinGpAsgs->filter(function ($withinGpAsg) { return !$this->testWithinGpAsgAvailable($withinGpAsg); }); }
/** * 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')); }
/** * 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 = Trainer::lists('name', 'id'); $courses = Course::lists('course_name', 'id'); return view('TrainerCoursesRelation.edit', compact('trainer_course', 'trainers', 'courses')); }
/** * Bootstrap the application services. * * @return void */ public function boot() { \View::composer('*', function ($view) { $allCourses = \App\Course::with('requirements')->orderBy('course_name', 'ASC')->get()->toArray(); $view->with('user', \Auth::user())->with('allCourses', $allCourses); }); }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { $courses = Course::all(); $user = Auth::User(); $user_id = $user->id; return view('trainee.create', compact('courses'))->with('user_id', $user_id); }
public function publicShow($id) { $training = Training::whereid($id)->firstOrFail(); $courses = Course::wheretraining_id($id)->get(); $testimonials = Testimonial::wheretraining_id($id)->get(); return view('trainings.public_training_pages.show', compact('training'), compact('courses'))->with('testimonials', $testimonials); }
public function show($slug) { $course = Course::where('slug', $slug)->firstOrFail(); $breadcrumbs = array(action('HomeController@show') => 'Início', action('CourseController@all') => 'Cursos', action('CourseController@show', $slug) => $course->name); $previous = action('CourseController@all'); return view('course', compact('breadcrumbs', 'previous', 'course')); }
public function destroy($id) { $course = Course::findOrFail($id); $course->delete(); session()->flash('success', 'El curso ' . $course->name . ' se ha eliminado.'); return redirect()->route('admin.course.index'); }
public function show($id) { $courses = Course::whereId($id)->firstOrFail(); $training_id = $courses->training_id; $training_name = $this->training_name_by_training_id($training_id); return view('course.show_public', compact('courses', 'training_name')); }
public function getSortableCourses($sort = 'name', $direction = 'asc') { if (!in_array($sort, ['name', 'par'])) { $sort = 'name'; } return Course::join('holes', 'holes.course_id', '=', 'courses.id')->select('courses.slug', 'courses.name', DB::raw('sum(holes.par) as par'))->orderBy($sort, $direction)->groupBy('courses.id')->paginate(10); }
public function new_student() { $data['courses'] = Course::all(); $data['majors'] = DB::table('tbl_major')->get(); $data['religions'] = DB::table('tbl_religion')->get(); return view(Api::getView(), $data); }
public function run() { DB::table('courses')->delete(); for ($i = 0; $i < 10; $i++) { Course::create(['id' => 'id ' . $i, 'id_1' => 'id_1' . $i, 'id_2' => 'id_2' . $i, 'id_3' => 'id_3' . $i, 'id_4' => 'id_4' . $i, 'name' => 'name' . $i, 'author' => 'author' . $i, 'introduction' => 'introduction' . $i, 'body' => 'body' . $i, 'pay_type' => 'pay_type' . $i, 'score' => 'score' . $i, 'ava_dir' => $i, 'vid_dir' => 'vid_dir' . $i]); } }
public function main(Request $request) { switch ($request->data) { case "courses": $courses = Course::all(); foreach ($courses as $course) { $course["status"] = $course->seatsStatus(); $course["enrolled"] = $course->totalEnrolled(); $course["waitlist"] = $course->totalWaitlisted(); } return response()->json(['courses' => $courses]); case "gpa": if ($request->has('student_id')) { $student = User::find($request->get('student_id')); return $student->gpa(); } else { return []; } case "classestaken": return Auth::user()->pastClasses(); case "activecodes": $section_id = $request->get('section_id'); return Auth::user()->returnActiveCodes($section_id); case "generateaddcode": $section_id = $request->get('section_id'); Auth::user()->generateAddCode($section_id); return redirect()->action('CoursesController@addCode'); default: return "no data specified"; } }
/** * @param Request $request * @param $code * @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response */ public function showCourseStatistics(Request $request, $code) { if ($request->ajax()) { $courses = Course::join('semesters', 'courses.semester_id', '=', 'semesters.id')->join('teachers', 'courses.teacher_id', '=', 'teachers.id')->select('courses.code as Code', 'courses.name as Title', 'teachers.name as Teacher', 'semesters.name as Semester')->where('courses.department_code', '=', $code)->get(); $unassignedCourses = Course::join('semesters', 'courses.semester_id', '=', 'semesters.id')->select('courses.code as Code', 'courses.name as Title', 'courses.teacher_id as Teacher', 'semesters.name as Semester')->where('courses.department_code', '=', $code)->whereNull('courses.teacher_id')->get(); return response([$courses, $unassignedCourses]); } }
public function show($course_id) { $course = Course::find($course_id); if ($course) { return $this->createSuccessResponse($course, 200); } return $this->createErrorResponse("The course with id {$course_id} does not exists", 404); }
public function getRemoved($crn) { $course_id = \App\Course::where('crn', '=', $crn)->first()->id; $user = \Auth::user(); $user->courses()->detach($course_id); \Session::flash('flash_message', 'The course was removed from your list!'); return redirect()->back(); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { //course is determined by the button pushed in the courses index page $course = Course::where('course_id', $id)->lists('course_name', 'course_id'); //user role must be 3, meaning this retrieves a student list with no admins/instructors $users = User::where('user_role', 3)->lists('user_name', 'user_id'); return view('courses.rosters')->with('course', $course)->with('users', $users); }