public function lastPeriodbyOrganizationAndByFiscalYear($organizationId, $fiscalYearId)
  {
    $Period = $this->Period->selectRaw('id, end_date, max(month) as month')
      ->where('organization_id', '=', $organizationId)
      ->where('fiscal_year_id', '=', $fiscalYearId)
      ->orderBy('month', 'desc')
      ->groupBy(array('id', 'end_date'))
      ->first();

    return $Period;
  }
public function lastPeriodbyOrganizationAndByFiscalYear($organizationId, $fiscalYearId)
  {
    $Period = $this->Period->selectRaw('id, end_date, max(month) as month')
      ->where('organization_id', '=', $organizationId)
      ->where('fiscal_year_id', '=', $fiscalYearId)
      ->orderBy('month', 'desc')
      ->groupBy(array('id', 'end_date'))
      ->first();

    return $Period;
  }
public function lastPeriodbyOrganizationAndByFiscalYear ( $ organizationId , $ fiscalYearId ) { $ Period = $ this -> Period -> selectRaw ( 'id, end_date, max(month) as month' ) -> where ( 'organization_id' , '=' , $ organizationId ) -> where ( 'fiscal_year_id' , '=' , $ fiscalYearId ) -> orderBy ( 'month' , 'desc' ) -> groupBy ( array ( 'id' , 'end_date' ) ) -> first ( ) ; return $ Period ; }
Get last period by organization and by fiscal year

@param  int $id Organization id

@return Illuminate\Database\Eloquent\Collection
Get last period by organization and by fiscal year