original_string: protected function academicPeriods()
      {
          if ( ! $this->filtersAppliedToPeriods()) return AcademicPeriod::all();
          if (str_contains($this->filters[0], '-')) {
              try {
                  return collect([AcademicPeriod::where(['academic_periods_name' => $this->filters[0]])->firstOrFail()]);
              } catch (\Exception $e) {
                  return collect([AcademicPeriod::where(['academic_periods_shortname' => $this->filters[0]])->firstOrFail()]);
              }
          }
          if ( ! is_numeric($this->filters[0])) throw new \InvalidArgumentException();
          return collect([AcademicPeriod::findOrFail(intval($this->filters[0]))]);
      }
code: protected function academicPeriods()
      {
          if ( ! $this->filtersAppliedToPeriods()) return AcademicPeriod::all();
          if (str_contains($this->filters[0], '-')) {
              try {
                  return collect([AcademicPeriod::where(['academic_periods_name' => $this->filters[0]])->firstOrFail()]);
              } catch (\Exception $e) {
                  return collect([AcademicPeriod::where(['academic_periods_shortname' => $this->filters[0]])->firstOrFail()]);
              }
          }
          if ( ! is_numeric($this->filters[0])) throw new \InvalidArgumentException();
          return collect([AcademicPeriod::findOrFail(intval($this->filters[0]))]);
      }
code_tokens: protected function academicPeriods ( ) { if ( ! $ this -> filtersAppliedToPeriods ( ) ) return AcademicPeriod :: all ( ) ; if ( str_contains ( $ this -> filters [ 0 ] , '-' ) ) { try { return collect ( [ AcademicPeriod :: where ( [ 'academic_periods_name' => $ this -> filters [ 0 ] ] ) -> firstOrFail ( ) ] ) ; } catch ( \ Exception $ e ) { return collect ( [ AcademicPeriod :: where ( [ 'academic_periods_shortname' => $ this -> filters [ 0 ] ] ) -> firstOrFail ( ) ] ) ; } } if ( ! is_numeric ( $ this -> filters [ 0 ] ) ) throw new \ InvalidArgumentException ( ) ; return collect ( [ AcademicPeriod :: findOrFail ( intval ( $ this -> filters [ 0 ] ) ) ] ) ; }
docstring: Get academic periods.
  
  @return \Illuminate\Database\Eloquent\Collection|\Illuminate\Support\Collection|static[]
docstring_tokens: Get academic periods .