Ejemplo n.º 1
0
 public function show($entity, $id)
 {
     $entity = \EntityDriver::findByRouteName($entity);
     $driver = new \EntityCrudDriver($entity->model_name);
     $item = $driver->get($id);
     return $item;
 }
Ejemplo n.º 2
0
 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'));
 }
Ejemplo n.º 3
0
 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);
 }
Ejemplo n.º 4
0
 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();
 }
Ejemplo n.º 5
0
 public function codeRoutes()
 {
     $routes = \PublicRouteDriver::all();
     $entities = \EntityDriver::all();
     $this->codeRoutesForRoutesAndEntities($routes, $entities);
 }
Ejemplo n.º 6
0
 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);
 }
Ejemplo n.º 7
0
 public function migrateEntity($entity, $migration_id)
 {
     $migrations = array_dot(\EntityDriver::getMigrations($entity->id));
     $migration = $migrations[$migration_id];
     eval($migration);
 }
Ejemplo n.º 8
0
 public function destroy($id)
 {
     \EntityDriver::delete($id);
     return \Redirect::route('dev.entities.index');
 }
Ejemplo n.º 9
0
Archivo: routes.php Proyecto: joadr/cms
<?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');
});