/** * Returns a form with existing license data to allow an admin to * update license information. * * @author [A. Gianotto] [<*****@*****.**>] * @since [v1.0] * @param int $licenseId * @return View */ public function getEdit($licenseId = null) { // Check if the license exists if (is_null($license = License::find($licenseId))) { // Redirect to the blogs management page return redirect()->to('admin/licenses')->with('error', trans('admin/licenses/message.does_not_exist')); } elseif (!Company::isCurrentUserHasAccess($license)) { return redirect()->to('admin/licenses')->with('error', trans('general.insufficient_permissions')); } if ($license->purchase_date == "0000-00-00") { $license->purchase_date = null; } if ($license->purchase_cost == "0.00") { $license->purchase_cost = null; } // Show the page $license_options = array('' => 'Top Level') + DB::table('assets')->where('id', '!=', $licenseId)->pluck('name', 'id'); $depreciation_list = array('0' => trans('admin/licenses/form.no_depreciation')) + Depreciation::pluck('name', 'id')->toArray(); $supplier_list = array('' => 'Select Supplier') + Supplier::orderBy('name', 'asc')->pluck('name', 'id')->toArray(); $maintained_list = array('' => 'Maintained', '1' => 'Yes', '0' => 'No'); $company_list = Helper::companyList(); return View::make('licenses/edit', compact('license'))->with('license_options', $license_options)->with('depreciation_list', $depreciation_list)->with('supplier_list', $supplier_list)->with('company_list', $company_list)->with('maintained_list', $maintained_list); }