|
|
|
@ -2,14 +2,14 @@ |
|
|
|
|
|
|
|
namespace App\AdminAgent\Controllers; |
|
|
|
|
|
|
|
use App\AdminAgent\Repositories\Slide; |
|
|
|
use App\AdminAgent\Repositories\Advertising; |
|
|
|
use Dcat\Admin\Admin; |
|
|
|
use Dcat\Admin\Form; |
|
|
|
use Dcat\Admin\Grid; |
|
|
|
use Dcat\Admin\Show; |
|
|
|
use Dcat\Admin\Http\Controllers\AdminController; |
|
|
|
|
|
|
|
class SlideController extends AdminController |
|
|
|
class AdvertisingController extends AdminController |
|
|
|
{ |
|
|
|
/** |
|
|
|
* Make a grid builder. |
|
|
|
@ -18,7 +18,7 @@ class SlideController extends AdminController |
|
|
|
*/ |
|
|
|
protected function grid() |
|
|
|
{ |
|
|
|
return Grid::make(new Slide(), function (Grid $grid) { |
|
|
|
return Grid::make(new Advertising(), function (Grid $grid) { |
|
|
|
$grid->model()->where('agent_id', Admin::user()->id)->orderBy('sort')->orderBy('id', 'DESC'); |
|
|
|
|
|
|
|
$grid->column('id')->sortable(); |
|
|
|
@ -47,7 +47,7 @@ class SlideController extends AdminController |
|
|
|
*/ |
|
|
|
protected function detail($id) |
|
|
|
{ |
|
|
|
return Show::make($id, new Slide(), function (Show $show) { |
|
|
|
return Show::make($id, new Advertising(), function (Show $show) { |
|
|
|
//不允许查看非自己的数据
|
|
|
|
if ($show->model()->agent_id != Admin::user()->id) { |
|
|
|
Admin::exit('数据不存在'); |
|
|
|
@ -72,7 +72,7 @@ class SlideController extends AdminController |
|
|
|
*/ |
|
|
|
protected function form() |
|
|
|
{ |
|
|
|
return Form::make(new Slide(), function (Form $form) { |
|
|
|
return Form::make(new Advertising(), function (Form $form) { |
|
|
|
//不允许查看非自己的数据
|
|
|
|
if ($form->isEditing() && $form->model()->agent_id != Admin::user()->id) { |
|
|
|
return $form->response()->error('数据不存在'); |