public function getClone($licenseId = null) { // Check if the license exists if (is_null($license_to_clone = 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_to_clone)) { return redirect()->to('admin/licenses')->with('error', trans('general.insufficient_permissions')); } // Show the page $license_options = array('0' => 'Top Level') + License::pluck('name', 'id')->toArray(); $maintained_list = array('' => 'Maintained', '1' => 'Yes', '0' => 'No'); $company_list = Helper::companyList(); //clone the orig $license = clone $license_to_clone; $license->id = null; $license->serial = null; // Show the page $depreciation_list = Helper::depreciationList(); $supplier_list = Helper::suppliersList(); return View::make('licenses/edit')->with('license_options', $license_options)->with('depreciation_list', $depreciation_list)->with('supplier_list', $supplier_list)->with('license', $license)->with('maintained_list', $maintained_list)->with('company_list', $company_list); }