/** * Run the database seeds. * * @return void */ public function run() { // $sub = new Subject(); $sub->name = "web development"; $sub->teacher = "abc"; $sub->code = "wb-2010"; $sub->save(); }
/** * Show the form for creating a new resource. * * @return Response */ public function create($subject_id, $class_id) { $exams = \App\Exam::all(); $subject = \App\Subject::find($subject_id); $class = \App\Grade::find($class_id); return view('reports.create')->with('title', 'SMS|REPORT')->with('class', $class)->with('subject', $subject)->with('exams', $exams); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $departments = Department::all(); $subjects = Subject::all(); $department_subject = DepartmentSubject::find($id); return view('admin.department_subject.department_subject_edit', compact('departments', 'subjects', 'department_subject')); }
public function connectionDestroy(Request $request, $lecture_id) { $goal = Goal::find($request->goal_id); $subject = Subject::find($request->subject_id); $goal->subjects()->detach($subject); return $request->goal_id . " -- " . $request->subject_id; }
function dayPeriod_list() { $data['owner'] = $this->owner; $data['system'] = $this->system; if ($this->owner == 1) { $subject_owner = Subject::where('nstp', 0)->where(function ($query) { $query->where('owner', 1)->orWhere('gessubject', 1); })->where('computersubject', 0)->where('nstp', 0)->get(); } elseif ($this->system->employeeid == Auth::user()->id) { $subject_owner = Subject::where('gesubject', 0)->where(function ($query) { $query->where('computersubject', 1)->orWhere('nstp', 1); })->get(); } else { $subject_owner = Subject::where('nstp', 0)->where('owner', $this->owner)->where('computersubject', 0)->where('gesubject', 0)->get(); } $data['subject'] = $subject_owner; if ($this->system->classallocationstatus != 3) { $data['val'] = 'class not init'; } else { $s = DB::table('tbl_completion')->where('stage', 4)->where('completedby', Auth::user()->id)->count(); if ($s > 1) { $data['val'] = 'attested'; } else { $data['sub'] = Classallocation::getAlloc($this->owner, $this->system); } } $t = Academicterm::find($this->system->phaseterm); $term = DB::table('tbl_term')->where('id', $t->term)->first(); $data['acam'] = $t->systart . ' - ' . $t->syend . ' Term: ' . $term->shortname; return view('dean.add_day_period', $data); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Contracts\View\Factory */ public function edit($id) { $paper = Paper::findOrFail($id); $subjects = Subject::all(); $questions = $paper->questions; return view('paper.edit', compact('paper', 'subjects', 'questions')); }
public function index() { $data['system'] = $this->system; $data['count'] = DB::table('tbl_completion')->where('academicterm', $this->system->phaseterm)->where('stage', 2)->where('completedby', Session::get('uid'))->count(); $data['$sql'] = Subject::getSubject($this->owner, $this->system); return view('dean.manage_section', $data); }
/** * Run the database seeds. * * @return void */ public function run() { Subject::create(['name' => 'Engineering Technology', 'code' => '065', 'abbreviation' => 'ET', 'category_id' => 1]); Subject::create(['name' => 'Biosystem Technology', 'code' => '066', 'abbreviation' => 'BT', 'category_id' => 1]); Subject::create(['name' => 'Science For Technology', 'code' => '067', 'abbreviation' => 'SFT', 'category_id' => 1]); Subject::create(['name' => 'Physics', 'code' => '001', 'abbreviation' => 'PHY', 'category_id' => 2]); Subject::create(['name' => 'Chemistry', 'code' => '002', 'abbreviation' => 'CHM', 'category_id' => 2]); }
/** * Run the database seeds. * * @return void */ public function run() { $subjects = ['Toán', 'Lý', 'Hoá', 'Sinh', 'Văn', 'Sử', 'Địa', 'Tiếng Anh', 'Tiếng Pháp', 'Tiếng Nga', 'Tiếng Nhật', 'Tiếng Đức', 'Tin Học']; foreach ($subjects as $key => $value) { $subject = Subject::create(['key' => Common::createKeyURL($value), 'priority' => 0, 'is_publish' => 1, 'created_by' => 'vankhoe', 'updated_by' => 'vankhoe']); SubjectTranslation::create(['subject_id' => $subject->id, 'locale' => 'vi', 'name' => $value]); } }
/** * @param $id * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function store($id, \Illuminate\Http\Request $request) { $this->validate($request, ['grade' => 'required', 'factor' => 'required']); $subject = Subject::findOrFail($id); $grade = new Grade(Request::all()); $subject->grades()->save($grade); return redirect('groups'); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $learners = \App\Student::all(); $staff = Staff::all(); $subjects = \App\Subject::all(); $streams = \App\Stream::all(); $classes = \App\Grade::all(); return view('admin.index')->with('title', 'SMS|Dashboard')->with('learners', $learners)->with('staff', $staff)->with('subjects', $subjects)->with('streams', $streams)->with('classes', $classes); }
function show($id) { $subject_id = Subjects::findOrFail($id); $owner = Api::getCollege(); if ($subject_id instanceof ModelNotFoundException) { return view('errors.404'); } return view('dean.subject', ['subject' => $subject_id, 'owner' => $owner]); }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { $subjects = Subject::orderBy('name')->get(); $subjectmapping = []; foreach ($subjects as $subject) { $subjectmapping[$subject->id] = $subject->name; } return view('circle.create', ['subjectmapping' => $subjectmapping]); }
public function Subjects(Request $request) { $this->validate($request, ['class' => 'required']); $class = $request->get('class'); $subjects = Subject::where('class', '=', $class)->where('trash', '=', false)->get(); $subjects[0]['token'] = $request->get("_token"); $subjects->toJSON(); return $subjects; }
/** * @param $id * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function destroy($id) { $subject = Subject::findOrFail($id); if ($subject->group->user->id != Auth::id()) { return redirect('groups'); } $subject->delete(); return redirect('groups'); }
public function analyseStudentPerformance($studentId) { $student = User::find($studentId); $studentTeachingSection = TeachingSection::where('users_id', '=', $studentId)->first(); // dd($studentTeachingSection); $studentSection = Section::find($studentTeachingSection->sections_id); $studentArray = array(); $studentArray['name'] = $student->name; $studentArray['realname'] = $student->realname; $studentArray['grade'] = $studentSection->grade; $studentArray['order'] = $studentSection->order; // a table show all exminations the student has token // show the different table of different subjects. $allTranscripts = Transcript::where('users_id', '=', $studentId)->get(); // dd($allTranscripts); $studentExaminations = array(); $i = 0; foreach ($allTranscripts as $transcript) { /*对该成绩单的学生的每次考试的语文,数学,英语三科的排名*/ $studentExaminations[$i]['chineseRanking'] = Transcript::getStudentSubjectRanking($transcript, 1); $studentExaminations[$i]['mathRanking'] = Transcript::getStudentSubjectRanking($transcript, 2); $studentExaminations[$i]['englishRanking'] = Transcript::getStudentSubjectRanking($transcript, 3); $examination = Examination::find($transcript->examinations_id); $studentExaminations[$i]['examination_name'] = $examination->name; $studentExaminations[$i]['examination_semester'] = $examination->semester; $studentExaminations[$i]['examination_date'] = $examination->date; $studentExaminations[$i]['total'] = $transcript->total; $studentExaminations[$i]['rank'] = $transcript->rank; $subjects = Subject::where('transcripts_id', '=', $transcript->id)->get(); foreach ($subjects as $subject) { $subjectType = $subject->type; if ($subjectType == 1) { $studentExaminations[$i]['chinese'] = $subject->score; } elseif ($subjectType == 2) { $studentExaminations[$i]['math'] = $subject->score; } elseif ($subjectType == 3) { $studentExaminations[$i]['english'] = $subject->score; } elseif ($subjectType == 4) { $studentExaminations[$i]['physics'] = $subject->score; } elseif ($subjectType == 5) { $studentExaminations[$i]['biology'] = $subject->score; } elseif ($subjectType == 6) { $studentExaminations[$i]['chemistry'] = $subject->score; } elseif ($subjectType == 7) { $studentExaminations[$i]['history'] = $subject->score; } elseif ($subjectType == 8) { $studentExaminations[$i]['politics'] = $subject->score; } else { $studentExaminations[$i]['geography'] = $subject->score; } } $i++; } //dd($studentExaminations); return view('scores.analyseStudentPerformance', compact('studentArray', 'studentExaminations')); }
public function create($id) { $user = User::find($id); if ($user->type == 'student') { $subjects = Subject::all(); } else { $subjects = Subject::where('department_id', $user->department_id)->get(); } return view('admin.user.subject.add', compact('id', 'subjects')); }
public function test() { $subjects = \App\Subject::lists('name')->toJson(); $file = 'subjects.json'; $write = File::put($file, $subjects); if ($write == false) { return 'False roi em oi'; } return 'Good!'; }
public function store(Request $request, $lecture_id, $subject_id) { $subject = Subject::find($subject_id); $assignment = new Assignment(); $assignment->due_date = $request->due_date . ' 23:59'; $assignment->subject()->associate($subject); $assignment->save(); $assignment->knowledgeunits()->attach(Input::get('knowledgeunits')); return redirect('/lectures/' . $lecture_id . '/assignments/subjects/' . $subject_id); }
public function edit(Request $request, $lecture_id, $subject_id, $topic_id) { $lecture = Lecture::find($lecture_id); $subject = Subject::find($subject_id); $topic = Topic::find($topic_id); $data["nav"] = "<a href=\"" . url('/lectures/') . "\">" . $lecture->title . "</a> <span class=\"fa fa-chevron-right\"></span> <a href=\"" . url('/lectures/' . $lecture->id . '/subjects/') . "\">" . $subject->title . "</a>"; $data["lecture_id"] = $lecture_id; $data["subject_id"] = $subject_id; $data["topic"] = $topic; return view('topic.edit', $data); }
/** * Create a new user controller instance. * * @return void */ public function __construct() { $this->priviledge_user(); $this->_user = \Auth::user(); if (2 == $this->_user->role_id) { $this->_query_connect = "="; $this->_query_value = $this->_user->department_id; } $this->_faculty_departments = Department::where('id', $this->_query_connect, $this->_query_value)->lists('name', 'id'); $this->_faculty_subjects = Subject::lists('name', 'id'); }
public function updateSubject(UpdateSubjectRequest $req) { $subject = Subject::find($req->id); $subject->catalog_no = $req->catalog_no; $subject->descriptive_title = $req->descriptive_title; $subject->lec_units = $req->lec_units; $subject->lab_units = $req->lab_units; $subject->total_units = $req->total_units; $subject->status = $req->status; $subject->save(); }
public function deleteSubject($id) { $subject = Subject::where('id', '=', $id)->where('trash', '=', true)->delete(); $partitions = Partition::where('subject_id', '=', $id)->where('trash', '=', true)->delete(); $questions = Question::where('subject_id', '=', $id)->where('trash', '=', true); foreach ($questions->get() as $value) { $answers = Answer::where('question_id', '=', $value->id)->where('trash', '=', true)->delete(); } $questions->delete(); return back(); }
/** * Run the database seeds. * * @return void */ public function run() { $users = \App\User::all(); $users_count = count($users) - 1; $subjects = \App\Subject::all(); $subjects_count = count($subjects) - 1; $data = []; for ($i = 0; $i < 100; $i++) { $data[] = ['description' => '', 'subject_id' => $subjects[rand(0, $subjects_count)]->id, 'user_id' => $users[rand(0, $users_count)]->id, 'date_time' => '2015-' . rand(1, 12) . '-' . rand(1, 28) . ' ' . rand(8, 20) . ':' . rand(0, 1) * 3 . '0', 'duration' => (double) rand(1, 6) / 2]; } DB::table('exam_schedules')->insert($data); }
public function showAllSubjectBysemester($course_code, $semester) { $validator = Validator::make(array('code' => $course_code, '$semester' => $semester), array('code' => array('regex:/(?i)^[a-z]+/'), 'semester' => array('regex:/[0-9]+/'))); if ($validator->fails()) { return response()->json(['error' => true, 'message' => $validator->messages()]); } $subject = Subject::where('course_code', 'like', $course_code)->where('semester', $semester)->get(); if ($subject->isEmpty()) { return response()->json(['error' => true, 'description' => 'no code is found']); } return response()->json(['error' => false, 'couse_code' => $course_code, 'sub_topic' => $subject->toArray()]); }
/** * Run the database seeds. * * @return void */ public function run() { $weekdays = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']; $users = \App\User::all(); $users_count = count($users) - 1; $subjects = \App\Subject::all(); $subjects_count = count($subjects) - 1; $data = []; for ($i = 0; $i < 100; $i++) { $data[] = ['weekday' => $weekdays[rand(0, 6)], 'subject_id' => $subjects[rand(0, $subjects_count)]->id, 'user_id' => $users[rand(0, $users_count)]->id, 'time' => rand(8, 20) . ':00']; } DB::table('schedules')->insert($data); }
/** * Run the database seeds. * * @return void */ public function run() { $faker = Factory::create('fr_FR'); $subjectsCount = Subject::all()->count(); for ($qcms = 0; $qcms < 100; $qcms++) { $qcm = Qcm::create(['user_id' => 1, 'subject_id' => rand(1, $subjectsCount - 1), 'name' => $faker->sentence(6), 'description' => $faker->sentence(40)]); for ($questions = 0; $questions < rand(5, 10); $questions++) { $question = Question::create(['qcm_id' => $qcm->id, 'question' => $faker->sentence(20)]); for ($answers = 0; $answers < rand(2, 4); $answers++) { Answer::create(['question_id' => $question->id, 'answer' => $faker->sentence(10), 'isValid' => $answers == 0]); } } } }
public function seedClassSubject() { $drafts = Draft::all(); foreach ($drafts as $index => $draft) { $maMH = $draft->maMH; $maLMH = $draft->maLMH; $classSubjects = ClassSubject::all()->where('maLMH', $maLMH); $subject = Subject::all()->where('maMH', $maMH)->first(); $subject_id = $subject->id; if ($classSubjects->count() == 0) { $c = ClassSubject::create(['maLMH' => $maLMH, 'subject' => $subject_id]); var_dump($c->maLMH); } } }
public function edit(Request $request, $lecture_id, $subject_id, $topic_id, $knowledgeunit_id, $question_id) { $lecture = Lecture::find($lecture_id); $subject = Subject::find($subject_id); $topic = Topic::find($topic_id); $knowledgeunit = KnowledgeUnit::find($knowledgeunit_id); $question = Question::find($question_id); $data["nav"] = "<a href=\"" . url('/lectures/') . "\">" . $lecture->title . "</a> <span class=\"fa fa-chevron-right\"></span> <a href=\"" . url('/lectures/' . $lecture->id . '/subjects/') . "\">" . $subject->title . "</a> <span class=\"fa fa-chevron-right\"></span> <a href=\"" . url('/lectures/' . $lecture->id . '/subjects/' . $subject->id . '/topics/') . "\">" . $topic->title . "</a> <span class=\"fa fa-chevron-right\"></span> <a href=\"" . url('/lectures/' . $lecture->id . '/subjects/' . $subject->id . '/topics/' . $topic->id . '/knowledgeunits') . "\">" . $knowledgeunit->title . "</a> <span class=\"fa fa-chevron-right\"></span> <a href=\"" . url('/lectures/' . $lecture->id . '/subjects/' . $subject->id . '/topics/' . $topic->id . '/knowledgeunits/' . $knowledgeunit->id . '/questions') . "\">" . $question->title . "</a>"; $data["lecture_id"] = $lecture_id; $data["subject_id"] = $subject_id; $data["topic_id"] = $topic_id; $data["knowledgeunit_id"] = $knowledgeunit_id; $data["question"] = $question; return view('question.edit', $data); }
public function index() { $subjects = collect(Subject::where('trash', '=', false)->get()->toArray())->groupBy('name')->count(); $partitions = Partition::where('trash', '=', false)->count(); $invites = Invite::count(); $questions = Question::where('trash', '=', false)->count(); $users = User::count(); $trash = ''; $testrooms = ''; if (\Entrust::hasRole('admin')) { $trash = Question::where('trash', '=', true)->count() + Subject::where('trash', '=', true)->count() + Partition::where('trash', '=', true)->count() + TestRoom::where('teacher_id', '=', \Auth::user()->id)->where('trash', '=', true)->count(); } elseif (\Entrust::hasRole('teacher')) { $testrooms = TestRoom::where('teacher_id', '=', \Auth::user()->id)->count(); } return view('admin.welcome', ['subjects' => $subjects, 'partitions' => $partitions, 'invites' => $invites, 'questions' => $questions, 'users' => $users, 'trash' => $trash, 'testrooms' => $testrooms]); }