public function byOrganizationWithYear($id)
  {
    // return $this->Period->where('organization_id', '=', $id)->with('year')->get(); -> Evitar los with

    $periods = $this->DB->connection($this->databaseConnectionName)
      ->table('ACCT_Period As p')
      ->join('ACCT_Fiscal_Year AS f', 'f.id', '=', 'p.fiscal_year_id')
      ->where('p.organization_id', '=', $id)
      ->get(array('p.id', 'p.month', 'f.year'));

    return new Collection($periods);
  }
public function byOrganizationWithYear($id)
  {
    // return $this->Period->where('organization_id', '=', $id)->with('year')->get(); -> Evitar los with

    $periods = $this->DB->connection($this->databaseConnectionName)
      ->table('ACCT_Period As p')
      ->join('ACCT_Fiscal_Year AS f', 'f.id', '=', 'p.fiscal_year_id')
      ->where('p.organization_id', '=', $id)
      ->get(array('p.id', 'p.month', 'f.year'));

    return new Collection($periods);
  }
public function byOrganizationWithYear ( $ id ) { // return $this->Period->where('organization_id', '=', $id)->with('year')->get(); -> Evitar los with $ periods = $ this -> DB -> connection ( $ this -> databaseConnectionName ) -> table ( 'ACCT_Period As p' ) -> join ( 'ACCT_Fiscal_Year AS f' , 'f.id' , '=' , 'p.fiscal_year_id' ) -> where ( 'p.organization_id' , '=' , $ id ) -> get ( array ( 'p.id' , 'p.month' , 'f.year' ) ) ; return new Collection ( $ periods ) ; }
Retrieve periods by organization with its year

@param  int $id Organization id

@return Illuminate\Database\Eloquent\Collection
Retrieve periods by organization with its year