public function index($company_id = null)
{
$vendor = Str::lower($this->module_vendor);
$company_branch_model = $this->module_namespace . 'Models\\CompanyBranch';
if (!$company_id) {
$company_branches = $company_branch_model::with('country')->get();
$title = "All Company Branches";
} else {
$company_model = $this->module_namespace . 'Models\\Company';
$company = $company_model::find($company_id);
$company_branches = $company_branch_model::with('country')->where('company_id', $company_id)->get();
$title = "All Branches of {$company->name}";
}
$this->layout->title = $title;
$this->layout->content = View::make("{$this->module_alias}::branches.{$this->type}.index")->with('title', $title)->with('company_branches', $company_branches);
}