public function executives() { $executives_id = DB::table('executive_user')->select('executive_id')->where('year_id', '=', $this->id)->get(); $exec_id = array(); foreach ($executives_id as $e) { $exec_id[] = $e->executive_id; } if ($exec_id != null) { return Executive::whereIn('id', $exec_id)->get(); } else { return array(); } }