public function index()
{
$router = app()->make('router');
$route = $router->currentRouteName() ?: $router->current()->getPath();
// Enable tabbed view for company_info only
$tabbed_view = ends_with($route, 'company_info');
$vendor = Str::lower($this->module_vendor);
$company_model = $this->module_namespace . 'Models\\Company';
$company_branch_model = $this->module_namespace . 'Models\\CompanyBranch';
$companies = $company_model::with('country')->get();
$company_branches = $company_branch_model::with('country');
if (current_user_companies()) {
$company_branches = $company_branches->where('company_id', current_user_companies());
}
$company_branches = $company_branches->get();
$title = 'All Companies and Company Branches';
$this->layout->title = $title;
$this->layout->content = View::make("{$this->module_alias}::companies.{$this->type}.index")->with('title', $title)->with('companies', $companies)->with('company_branches', $company_branches)->with('tabbed_view', $tabbed_view);
}