public function getPackage($travel_agent_id, $package_id = null) { $data = $this->model->findorfail($travel_agent_id); // ------------------------------------------------------------------------------------------------------------ // Current Package // ------------------------------------------------------------------------------------------------------------ if ($package_id) { $package = \App\PackageTravelAgent::find($package_id); if (!$package || $package->travel_agent_id != $travel_agent_id) { App::abort(404); } } // ------------------------------------------------------------------------------------------------------------ // Package list // ------------------------------------------------------------------------------------------------------------ $package_list = \App\Package::orderBy('priority', 'desc')->get(); // ------------------------------------------------------------------------------------------------------------ // SHOW DISPLAY // ------------------------------------------------------------------------------------------------------------ $this->layout->page = view($this->page_base_dir . 'package')->with('route_name', $this->route_name)->with('view_name', $this->view_name); $this->layout->page->data = $data; $this->layout->page->package_list = $package_list; $this->layout->page->package = $package; return $this->layout; }