You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Title: Direct Validation in Controllers Instead of Form Requests
Issue Description
Currently, validation is being done directly inside controller methods using $request->validate([...]). This approach can make controllers bulky and harder to maintain. Instead, we should use Form Request classes to separate validation logic, improve reusability, and keep controllers clean.
Problems with Current Approach
Controllers contain validation logic, making them harder to read and maintain.
Validation rules are not reusable across multiple methods.
No centralized place to handle custom validation messages or logic.
Proposed Solution
Move validation logic to dedicated Form Request classes.
Update controllers to use $request->validated() instead of handling validation directly.
Ensure all validation rules remain unchanged.
Benefits of This Change
✅ Keeps controllers clean and focused on business logic.
✅ Reusable validation rules across multiple methods.
✅ Easier to maintain and modify validation rules in one place.
✅ Allows better handling of custom validation messages.
The text was updated successfully, but these errors were encountered:
Title: Direct Validation in Controllers Instead of Form Requests
Issue Description
Currently, validation is being done directly inside controller methods using
$request->validate([...])
. This approach can make controllers bulky and harder to maintain. Instead, we should use Form Request classes to separate validation logic, improve reusability, and keep controllers clean.Problems with Current Approach
Proposed Solution
$request->validated()
instead of handling validation directly.Benefits of This Change
✅ Keeps controllers clean and focused on business logic.
✅ Reusable validation rules across multiple methods.
✅ Easier to maintain and modify validation rules in one place.
✅ Allows better handling of custom validation messages.
The text was updated successfully, but these errors were encountered: