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); }
/** * Get the clone page to clone a model * * @author [A. Gianotto] [<*****@*****.**>] * @since [v1.0] * @param int $modelId * @return View */ public function getClone($modelId = null) { // Check if the model exists if (is_null($model_to_clone = AssetModel::find($modelId))) { // Redirect to the model management page return redirect()->to('assets/models')->with('error', trans('admin/models/message.does_not_exist')); } $model = clone $model_to_clone; $model->id = null; // Show the page $depreciation_list = Helper::depreciationList(); $manufacturer_list = Helper::manufacturerList(); $category_list = Helper::categoryList('asset'); $view = View::make('models/edit'); $view->with('category_list', $category_list); $view->with('depreciation_list', $depreciation_list); $view->with('manufacturer_list', $manufacturer_list); $view->with('model', $model); $view->with('clone_model', $model_to_clone); return $view; }