public function show($entity, $id) { $entity = \EntityDriver::findByRouteName($entity); $driver = new \EntityCrudDriver($entity->model_name); $item = $driver->get($id); return $item; }
public function getAppJs() { $routes = \PublicRouteDriver::all(); $entities = \EntityDriver::all(); $content = \View::make('site.assets.appjs', compact('routes', 'entities')); return \Response::make($content, 200, array('Content-Type' => 'text/javascript')); }
public function __construct() { $uri = str_replace(\URL::route('admin.index'), '', \URL::current()); $parts = explode('/', $uri); $route_name = $parts[1]; $this->entity = \EntityDriver::findByRouteName($route_name); $this->driver = new \EntityCrudDriver($this->entity->model_name); }
public function onDelete($entity_attribute) { $entity = \EntityDriver::get($entity_attribute->entity_id); $migration = 'attributes.' . $entity_attribute->name . '.down'; $coder = new \Cms\Library\Helpers\Coder\EntitiesCoder(); try { $coder->migrateEntity($entity, $migration); } catch (\Exception $e) { } $coder->codeEntities(); }
public function codeRoutes() { $routes = \PublicRouteDriver::all(); $entities = \EntityDriver::all(); $this->codeRoutesForRoutesAndEntities($routes, $entities); }
public function destroy($entity_id, $attribute_id) { $attribute = \EntityDriver::getAttribute($entity_id, $attribute_id); \EntityDriver::deleteAttribute($attribute); return \Redirect::route('dev.entities.show', $entity_id); }
public function migrateEntity($entity, $migration_id) { $migrations = array_dot(\EntityDriver::getMigrations($entity->id)); $migration = $migrations[$migration_id]; eval($migration); }
public function destroy($id) { \EntityDriver::delete($id); return \Redirect::route('dev.entities.index'); }
<?php Route::group(['prefix' => 'admin', 'namespace' => 'Cms\\Admin\\Controllers', 'before' => 'permissions.admin'], function () { Route::get('/', ['as' => 'admin.index', 'uses' => 'DashboardController@index']); // Definitions Route::resource('definitions', 'DefinitionsController'); // Users Route::get('users/{id}/delete', ['as' => 'admin.users.delete', 'uses' => 'UsersController@delete']); Route::resource('users', 'UsersController'); Route::resource('files', 'FilesController'); try { foreach (\EntityDriver::all() as $index => $entity) { Route::get($entity->route_name . '/{id}/delete', ['as' => 'admin.' . $entity->route_name . '.delete', 'uses' => 'EntitiesController@delete']); Route::resource($entity->route_name, 'EntitiesController'); foreach ($entity->attributes as $index => $attribute) { if ($attribute->type == 'image_array') { Route::get($entity->route_name . '/{entity_id}/' . $attribute->name . '/{id}/delete', ['as' => 'admin.' . $entity->route_name . '.' . $attribute->name . '.delete', 'uses' => 'EntityImagesController@delete']); Route::resource($entity->route_name . '.' . $attribute->name, 'EntityImagesController'); } } } } catch (\Exception $e) { } }); Route::group(['prefix' => 'admin/ajax', 'namespace' => 'Cms\\Admin\\AjaxControllers', 'before' => 'permissions.admin'], function () { Route::get('/', ['as' => 'admin.ajax', 'uses' => 'DashboardController@index']); Route::get('files/{id}/download', ['as' => 'admin.ajax.files.download', 'uses' => 'FilesController@download']); Route::resource('files', 'FilesController'); Route::resource('file-links', 'FileLinksController'); Route::resource('folder-links', 'FolderLinksController'); });