-
Notifications
You must be signed in to change notification settings - Fork 10
Improve Manage teacher #16
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
base: manage-teacher
Are you sure you want to change the base?
Improve Manage teacher #16
Conversation
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.
Pull Request Overview
This PR enhances the ProfessorController by adding validation request classes for store and update operations, and wraps the destroy method in a database transaction for data integrity.
Key Changes:
- Added
StoreProfessorRequestandUpdateProfessorRequestclasses for input validation - Wrapped the
destroymethod in a DB transaction to ensure atomic deletion of professor and user records
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| StoreProfessorRequest.php | New validation request class defining required fields for creating professors |
| UpdateProfessorRequest.php | New validation request class defining optional fields for updating professors |
| ProfessorController.php | Updated store/update methods to use request classes and added transaction handling to destroy method |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { | ||
| return [ | ||
| 'name' => [ 'required', 'string', 'max:255', ], | ||
| 'email' => [ 'required', 'string','email', 'max:255', Rule::unique('users', 'email'), ], |
Copilot
AI
Oct 27, 2025
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.
Missing import for Rule class. Add use Illuminate\Validation\Rule; at the top of the file.
|
|
||
| return [ | ||
| 'name' => [ 'sometimes', 'string', 'max:255', ], | ||
| 'email' => [ 'sometimes', 'string','email', 'max:255', Rule::unique('users', 'email')->ignore($professorId), ], |
Copilot
AI
Oct 27, 2025
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.
Missing import for Rule class. Add use Illuminate\Validation\Rule; at the top of the file.
|
|
||
| DB::commit(); | ||
|
|
||
| retrun response()->json(null, 204); |
Copilot
AI
Oct 27, 2025
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.
Corrected spelling of 'retrun' to 'return'.
| retrun response()->json(null, 204); | |
| return response()->json(null, 204); |
| DB::commit(); | ||
|
|
||
| retrun response()->json(null, 204); | ||
| } catch (\Throwable e) { |
Copilot
AI
Oct 27, 2025
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.
Missing $ before variable name. Should be catch (\Throwable $e).
| } catch (\Throwable e) { | |
| } catch (\Throwable $e) { |
cca0ef1 to
ec42509
Compare
This PR intend to:
StoreandUpdaterequests toProfessorController.destroymethod onProfessorController.