Modules\Doptor\CompanyInfo\Controllers\CompanyBranchController::edit PHP Method

edit() public method

Show the form for editing the specified resource.
public edit ( integer $id )
$id integer
    public function edit($id)
    {
        if ($this->module_vendor) {
            $company_branch_model = "Modules\\{$this->module_vendor}\\{$this->module_alias}\\Models\\CompanyBranch";
        } else {
            $company_branch_model = "Modules\\{$this->module_alias}\\Models\\CompanyBranch";
        }
        $country_model = $this->module_namespace . 'Models\\Country';
        $company_model = $this->module_namespace . 'Models\\Company';
        $countries = $country_model::names();
        $companies = $company_model::names();
        $company_branch = $company_branch_model::with('incharges')->findOrFail($id);
        if (!can_user_access_company($company_branch->company_id)) {
            abort(501);
        }
        $incharge_count = $company_branch->incharges->count() ?: 1;
        $this->layout->title = "Edit Entry in {$this->module_name}";
        $this->layout->content = View::make("{$this->module_alias}::branches.{$this->type}.create_edit")->with('title', "Edit Entry in module {$this->module_name}")->with('company_branch', $company_branch)->with('countries', $countries)->with('companies', $companies)->with('incharge_count', $incharge_count);
    }