Skip to content

Instantly share code, notes, and snippets.

@makoru-hikage
Last active December 4, 2016 15:46
Show Gist options
  • Save makoru-hikage/78dd50841352af65d8c097601bf920e2 to your computer and use it in GitHub Desktop.
Save makoru-hikage/78dd50841352af65d8c097601bf920e2 to your computer and use it in GitHub Desktop.
This shows "Fatal error: Maximum function nesting level of '256' reached, aborting!"
<?php
public function getAcademicYearAttribute(){
$year_start = Carbon::parse($this->date_start)->year;
$year_end = Carbon::parse($this->date_end)->year;
$academic_year =
self::select(['date_start','date_end', 'semester'])
->whereYear('date_start', $year_start)
->where(function($q) use ($year_end){
$q->whereYear('date_end', '>=', $year_end)
->whereYear('date_end', '<=', $year_end + 1);
})->get();
return $academic_year;
}
//This is a cae of wrong loop, the one that goes forever
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment