Пример #1
0
 public function index()
 {
     $cfg = ['src' => $this->roleModel->query(), 'columns' => [['name' => 'name', 'label' => 'Имя', 'sortable' => true, 'filter' => ['name' => 'name', 'operator' => FilterConfig::OPERATOR_LIKE]], ['name' => 'display_name', 'label' => 'Отображаемое имя', 'sortable' => true, 'filter' => ['name' => 'display_name', 'operator' => FilterConfig::OPERATOR_LIKE]], ['name' => 'users', 'label' => 'Пользователи', 'callback' => function ($val) {
         $names = $val->lists('name');
         return implode(', ', $names);
     }], ['name' => 'actions', 'label' => '', 'callback' => function ($val, $row) {
         return '
                         <a href="' . route('admin.role.edit', ['role' => $row->getSrc()]) . '">
                             <span class="glyphicon glyphicon-pencil"></span></a>
                         <a data-method="delete" href="' . route('admin.role.destroy', ['role' => $row->getSrc()]) . '">
                             <span class="glyphicon glyphicon-trash"></span></a>';
     }]], 'footer' => ['component' => ['total_rows']]];
     $grid = \Grids::make($cfg);
     return view('adminPanel::role.index', compact('grid'));
 }
Пример #2
0
 static function show($position)
 {
     $route = Route::getCurrentRoute();
     if (!is_null($route)) {
         $route = $route->getActionName();
     }
     //get the location for this route
     $grid = Grids::where('route', '=', $route)->first();
     if (!isset($grid->id)) {
         $grid = Grids::find(1);
     }
     $result = '';
     foreach ($grid->blocks()->where('block_position', '=', $position)->get() as $block) {
         $datas = Event::fire($block->event_to_fire, array(unserialize($block->params)));
         foreach ($datas as $data) {
             if (isset($data)) {
                 $result .= View::make($block->view_path)->with('data', $data);
             }
         }
     }
     return $result;
 }
Пример #3
0
 public function delgrid($gridid)
 {
     $grid = Grids::find($gridid);
     $grid->delete();
     return Redirect::to('backend/gridmanager/')->withMessage($this->notifyView(Lang::get('grid_manager::messages.grid_deleted'), 'success'));
 }
Пример #4
0
Event::listen('backend.header.create', function () {
    return array('grid_manager/extends/backend/header');
}, 1);
Event::listen('backend.addons.saveaddoninfo.grid_manager', function ($addon) {
    Schema::create('gridmanager', function ($table) {
        $table->increments('id');
        $table->string('route', '100')->index();
        $table->string('grid_name', 100);
        $table->string('grid_title', 100);
        $table->string('grid_description', 160);
        $table->timestamps();
    });
    Schema::create('gridmanager_blocks', function ($table) {
        $table->increments('id');
        $table->integer('grids_id');
        $table->string('block_position', 250);
        $table->string('view_path', 250);
        $table->string('block_title', 250);
        $table->string('block_name', 250);
        $table->string('event_to_fire', 160);
        $table->text('params');
        $table->integer('sort');
        $table->timestamps();
    });
    $grid = new Grids();
    $grid->route = 'LaraController@showMainpage';
    $grid->grid_name = 'Default';
    $grid->grid_title = 'Default';
    $grid->grid_description = 'Default';
    $grid->save();
}, 1);