示例#1
0
    /**
     * Index Layout
     *
     * @return @Theme View
     */
    public function index()
    {
        Meta::title(Lang::get('meta.companies'));
        Meta::meta('description', Lang::get('meta.companies description'));
        $grid = new Grid((new GridConfig())->setDataProvider(new EloquentDataProvider(\App\Models\Company::query()))->setName('grid')->setPageSize(15)->setColumns([(new FieldConfig())->setName('_id')->setLabel(Lang::get('label.company id'))->setSortable(false)->setSorting(Grid::SORT_ASC), (new FieldConfig())->setName('name')->setLabel(Lang::get('label.name'))->setSortable(true), (new FieldConfig())->setName('active')->setLabel(Lang::get('label.active'))->setSortable(false)->setCallback(function ($val) {
            return '<a href="javascript:active(\'' . $val . '\')"><center><i class="fa ' . ($val ? 'fa-check' : 'fa-close') . '"></i></center></a>';
        }), (new FieldConfig())->setName('id')->setLabel(Lang::get('menu.edit'))->setSortable(false)->setCallback(function ($val) {
            return '
								<div class="dropdown">
									<button class="btn btn-primary btn-sm dropdown-toggle" type="button" data-toggle="dropdown">
									<i class="glyphicon glyphicon-edit"></i>
									' . Lang::get('menu.edit') . '
									<span class="caret"></span></button>
									<ul class="dropdown-menu">
										<li><a href="' . url('administration/companies/form/' . $val) . '"><i class="remove glyphicon glyphicon-edit"></i> ' . Lang::get('menu.edit') . '</a></li>
										<li><a href="#" class="delete" id="' . $val . '" ><i class="glyphicon glyphicon-trash"></i> ' . Lang::get('menu.remove') . '</a></li>
									</ul>
								</div>';
        })]));
        return Theme::view('companies.index', compact('grid', 'text'));
    }