12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- namespace App\Distributor\Controllers;
- use App\Distributor\Actions\SmmAddAccount;
- use App\Distributor\Repositories\SmmUserAccount;
- use Dcat\Admin\Form;
- use Dcat\Admin\Grid;
- use Dcat\Admin\Show;
- use Dcat\Admin\Http\Controllers\AdminController;
- use Dcat\Admin\Layout\Content;
- use Dcat\Admin\Admin;
- class SmmUserAccountController extends AdminController
- {
- /**
- * page index
- */
- public function index(Content $content)
- {
- return $content
- ->header('帐号管理')
- ->description('全部')
- ->body($this->grid());
- }
- /**
- * Make a grid builder.
- *
- * @return Grid
- */
- protected function grid()
- {
- return Grid::make(new SmmUserAccount(), function (Grid $grid) {
- $grid->column('id')->sortable();
- $grid->column('user_name');
- $grid->column('access_token');
- $grid->column('media_name');
- $grid->column('created_at');
- $grid->column('updated_at')->sortable();
- $grid->filter(function (Grid\Filter $filter) {
- $filter->panel();
- $filter->expand();
- $filter->like('user_name')->width(2);
- });
- //授权按钮
- // 传入数组
- $grid->rightTools([
- new SmmAddAccount(),
- ]);
- $grid->disableCreateButton();
- $grid->disableEditButton();
- $grid->model()->where('dist_id', getDistributorId())->orderBy('media_name', 'asc')->orderBy('id', 'desc');
- });
- }
- }
|