-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Subject Management #55
base: main
Are you sure you want to change the base?
Conversation
$department_code = $faculty->department_code; | ||
|
||
if ($faculty && $faculty->isHOD()) { | ||
$courses = Course::with(['Classroom','Subject','Faculty'])->get(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Classroom
, Subject
okke lower case alle vende
$classrooms = Classroom::all(); | ||
$faculties = Faculty::where('department_code',$department_code)->get(); | ||
$subjects = Subject::where('department_code',$department_code)->get(); | ||
$types = CourseTypes::getKeys(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use this enum directly in views, no need to pass from controller
$course->subject_code = $data["subject"]; | ||
// Here is room for improvement instead of again querying in database table,we can infer it from above | ||
// message/ do we need this in the first place <<Semester>> | ||
$course->semester = Classroom::where('id',$data["classroom"])->get('semester')->first()->semester; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use find
to get by id. Classroom::find($data["classroom"])->semester
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do course need a semester as it is always linked to classroom?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question, classroom was added after semester, so we do need to to think about it.
But an obvious reason for semester is Minor courses. They don't have a particular classroom.
Maybe we could make semester null for other courses, and add a getter getSemester()
to Course model, which will either get from classroom or from the semester field.
$editCourse->faculty_id=$data["faculty"]; | ||
$editCourse->classroom_id = $data["classroom"]; | ||
$editCourse->subject_code = $data["subject"]; | ||
$editCourse->type = CourseTypes::getValue($data["type"]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should all fields be updatable?
Faculty is ok, because they can be changed in between.
But subject, classroom and course_type?
* Move Course creation to model | ||
* Javascipt function to check subject code is unique or not in client side | ||
* Optimise Course creation | ||
* Update method - PUT/PATCH ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PATCH
*/ | ||
$auth_user = Auth::user(); | ||
$faculty = $auth_user->faculty; | ||
$department_code = $faculty->department_code; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Admin can create subjects. They may no be a faculty.
Checkout faculty.store
, where I encountered a similar situation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it better that HOD's do subject creation , since subject belongs to a department
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Admin can literally do anything, admin is GOD, so don't restrict admin.
@rkjcb camelCase is the convention, for almost all variable names, checkout that best practices repo. |
No description provided.