Skip to content

Commit

Permalink
Fix broken app
Browse files Browse the repository at this point in the history
  • Loading branch information
yungifez committed Aug 10, 2023
1 parent 5d434ad commit c8f9a97
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/Http/Middleware/CreateCurrentAcademicYearRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class CreateCurrentAcademicYearRecord
*/
public function handle(Request $request, Closure $next): Response
{
if(auth()->user()?->studentRecord?->academicYears()->find(auth()->user()->school->academic_year_id) == null){
if(auth()->user()?->studentRecord && !auth()->user()?->studentRecord?->academicYears()->find(auth()->user()->school->academic_year_id)){
auth()->user()->studentRecord->academicYears()->syncWithoutDetaching([
auth()->user()->school->academicYear->id => [
'my_class_id' => auth()->user()->studentRecord->my_class_id,
Expand Down

0 comments on commit c8f9a97

Please sign in to comment.