public function import($entity) { $appHelper = new libs\AppHelper(); $className = $appHelper->getNameSpace() . $entity; $model = new $className(); $table = $model->getTable(); $columns = \Schema::getColumnListing($table); $key = $model->getKeyName(); $notNullColumnNames = array(); $notNullColumnsList = \DB::select(\DB::raw("SHOW COLUMNS FROM `" . $table . "` where `Null` = 'no'")); if (!empty($notNullColumnsList)) { foreach ($notNullColumnsList as $notNullColumn) { $notNullColumnNames[] = $notNullColumn->Field; } } $status = \Input::get('status'); $filePath = null; if (\Input::hasFile('import_file') && \Input::file('import_file')->isValid()) { $filePath = \Input::file('import_file')->getRealPath(); } if ($filePath) { \Excel::load($filePath, function ($reader) use($model, $columns, $key, $status, $notNullColumnNames) { $this->importDataToDB($reader, $model, $columns, $key, $status, $notNullColumnNames); }); } $importMessage = $this->failed == true ? \Lang::get('panel::fields.importDataFailure') : \Lang::get('panel::fields.importDataSuccess'); return \Redirect::to('panel/' . $entity . '/all')->with('import_message', $importMessage); }
public function entityUrl($entity, $methods) { $appHelper = new libs\AppHelper(); $urls = Link::getMainUrls(); if (in_array($entity, $urls)) { $controller_path = 'Serverfireteam\\Panel\\' . $entity . 'Controller'; } else { $panel_path = \Config::get('panel.controllers'); if (isset($panel_path)) { $controller_path = '\\' . $panel_path . '\\' . $entity . 'Controller'; } else { $controller_path = $appHelper->getNameSpace() . 'Http\\Controllers\\' . $entity . 'Controller'; } } try { $controller = \App::make($controller_path); } catch (\Exception $ex) { throw new \Exception("Can not found the Controller ( {$controller_path} ) "); } if (!method_exists($controller, $methods)) { throw new \Exception('Controller does not implement the CrudController methods!'); } else { return $controller->callAction($methods, array('entity' => $entity)); } }
public function getEntityModel() { $entity = $this->getEntity(); $appHelper = new libs\AppHelper(); if (in_array($entity, Link::getMainUrls())) { $modelClass = 'Serverfireteam\\Panel\\' . $entity; } else { $modelClass = $appHelper->getNameSpace() . $this->getEntity(); } return new $modelClass(); }
public function edit($entity) { parent::edit($entity); $this->edit = \DataEdit::source(new Link()); Link::creating(function ($link) { //dd(__DIR__); $appHelper = new libs\AppHelper(); return class_exists($appHelper->getNameSpace() . $link['url']); }); $this->edit->label('Edit Admin'); $this->edit->link("rapyd-demo/filter", "Articles", "TR")->back(); $this->edit->add('display', 'Display', 'text'); $this->edit->add('url', 'link', 'text'); return $this->returnEditView(); }
public function edit($entity) { parent::edit($entity); $this->edit = \DataEdit::source(new Link()); Link::creating(function ($link) { $appHelper = new libs\AppHelper(); return class_exists($appHelper->getNameSpace() . $link['url']); }); $helpMessage = trans('rapyd::rapyd.links_help'); $this->edit->label('Edit Links'); $this->edit->link("rapyd-demo/filter", "Articles", "TR")->back(); $this->edit->add('display', 'Display', 'text'); $this->edit->add('url', 'link', 'text'); $this->addHelperMessage($helpMessage); return $this->returnEditView(); }
public function edit($entity) { parent::edit($entity); $this->edit = \DataEdit::source(new Link()); Link::creating(function ($link) { $appHelper = new libs\AppHelper(); return class_exists($appHelper->getNameSpace() . $link['url']); }); $helpMessage = \Lang::get('panel::fields.links_help'); $this->edit->label('Edit Links'); $this->edit->link("rapyd-demo/filter", "Articles", "TR")->back(); $this->edit->add('display', 'Display', 'text')->rule('required'); $this->edit->add('url', 'link', 'text')->rule('required'); $this->edit->saved(function () use($entity) { $this->edit->message(\Lang::get('panel::fields.dataSavedSuccessfull')); $this->edit->link('panel/Permission/all', \Lang::get('panel::fields.back')); }); $this->addHelperMessage($helpMessage); return $this->returnEditView(); }