diff --git a/app/Admin/Controllers/HomeController.php b/app/Admin/Controllers/HomeController.php index 5aa24e5..b3a22f0 100644 --- a/app/Admin/Controllers/HomeController.php +++ b/app/Admin/Controllers/HomeController.php @@ -8,11 +8,20 @@ use Dcat\Admin\Controllers\Dashboard; use Dcat\Admin\Layout\Column; use Dcat\Admin\Layout\Content; use Dcat\Admin\Layout\Row; +use Dcat\Admin\Admin; class HomeController extends Controller { public function index(Content $content) { + //dd(Admin::user()->roles); + if(Admin::user()->isRole('lanzu_business')){ + return $this->lanzu_biz($content); + } + return $this->default($content); + } + + protected function default(Content $content){ return $content ->header('Dashboard') ->description('Description...') @@ -33,4 +42,27 @@ class HomeController extends Controller }); }); } + + + protected function lanzu_biz(Content $content) + { + return $content->header('控制面板') + ->description('欢迎回到懒族后台') + ->body(function (Row $row) { + $row->column(6, function (Column $column) { + // $column->row(Dashboard::title()); + // $column->row(new Examples\Tickets()); + }); + + $row->column(6, function (Column $column) { + // $column->row(function (Row $row) { + // $row->column(6, new Examples\NewUsers()); + // $row->column(6, new Examples\NewDevices()); + // }); + + // $column->row(new Examples\Sessions()); + // $column->row(new Examples\ProductOrders()); + }); + }); + } } diff --git a/app/Admin/Controllers/ImsCjdcMarketController.php b/app/Admin/Controllers/ImsCjdcMarketController.php index 20510aa..31a5b15 100644 --- a/app/Admin/Controllers/ImsCjdcMarketController.php +++ b/app/Admin/Controllers/ImsCjdcMarketController.php @@ -41,8 +41,18 @@ class ImsCjdcMarketController extends AdminController $grid->column('addtime','创建时间'); $grid->filter(function (Grid\Filter $filter) { $filter->equal('id'); + }); + + + $grid->actions(function (Grid\Displayers\Actions $actions){ + + if(!\Admin::user()->isAdministrator()&&$actions->row->mp_id==0){ + $actions->disableDelete(); + $actions->disableEdit(); + } }); + }); } @@ -56,6 +66,18 @@ class ImsCjdcMarketController extends AdminController protected function detail($id) { return Show::make($id, new ImsCjdcMarket(), function (Show $show) { + + if(!\Admin::user()->isAdministrator()&&$show->model()->mp_id==0){ + $show->panel() + ->tools(function ($tools) { + $tools->disableEdit(); + $tools->disableList(); + $tools->disableDelete(); + // 显示快捷编辑按钮 + $tools->showQuickEdit(); + }); + } + $show->id; $show->name; $show->logo->image(); diff --git a/app/Admin/Controllers/LanzuServiceSpeakerController.php b/app/Admin/Controllers/LanzuServiceSpeakerController.php index 2e135b5..78d5aac 100755 --- a/app/Admin/Controllers/LanzuServiceSpeakerController.php +++ b/app/Admin/Controllers/LanzuServiceSpeakerController.php @@ -17,17 +17,20 @@ class LanzuServiceSpeakerController extends AdminController */ protected function grid() { - return Grid::make(new LanzuServiceSpeaker(), function (Grid $grid) { + return Grid::make(new LanzuServiceSpeaker(['store']), function (Grid $grid) { $grid->id->sortable(); $grid->device_name; $grid->store_id; + $grid->column('store.name'); + $grid->column('is_bind') + ->using([0=>'未绑定',1=>'已绑定']) + ->label([0=>'danger',1=>'success']); $grid->created_at; $grid->updated_at->sortable(); - $grid->filter(function (Grid\Filter $filter) { $filter->equal('id'); - + $filter->equal('store_id'); }); }); } diff --git a/app/Models/LanzuServiceSpeaker.php b/app/Models/LanzuServiceSpeaker.php index eb74b14..79029d2 100755 --- a/app/Models/LanzuServiceSpeaker.php +++ b/app/Models/LanzuServiceSpeaker.php @@ -11,4 +11,8 @@ class LanzuServiceSpeaker extends Model use HasDateTimeFormatter; protected $table = 'lanzu_service_speakers'; + public function store(){ + return $this->hasOne('\App\Models\LanzuStore','id','store_id'); + } + } diff --git a/app/Models/LanzuStore.php b/app/Models/LanzuStore.php new file mode 100644 index 0000000..43a0aaf --- /dev/null +++ b/app/Models/LanzuStore.php @@ -0,0 +1,14 @@ + 'Dcat Admin', + 'name' => '懒族后台管理系统', /* |-------------------------------------------------------------------------- @@ -165,7 +165,7 @@ return [ |-------------------------------------------------------------------------- */ 'helpers' => [ - 'enable' => true, + 'enable' => env('APP_ENV')=='prod'? false:true, ], /* diff --git a/dcat_admin_ide_helper.php b/dcat_admin_ide_helper.php index 9546a39..4c2146f 100644 --- a/dcat_admin_ide_helper.php +++ b/dcat_admin_ide_helper.php @@ -63,8 +63,6 @@ namespace Dcat\Admin { * @property Grid\Column|Collection loudspeaker_imei * @property Grid\Column|Collection dishes_menu_intro * @property Grid\Column|Collection create_time - * @property Grid\Column|Collection mp_id - * @property Grid\Column|Collection money * @property Grid\Column|Collection parent_id * @property Grid\Column|Collection order * @property Grid\Column|Collection icon @@ -155,6 +153,7 @@ namespace Dcat\Admin { * @property Grid\Column|Collection gender * @property Grid\Column|Collection birthday * @property Grid\Column|Collection bio + * @property Grid\Column|Collection money * @property Grid\Column|Collection score * @property Grid\Column|Collection successions * @property Grid\Column|Collection maxsuccessions @@ -387,6 +386,7 @@ namespace Dcat\Admin { * @property Grid\Column|Collection waimai_pay_temp * @property Grid\Column|Collection dangmian_pay_temp * @property Grid\Column|Collection ziti_pay_temp + * @property Grid\Column|Collection mp_id * @property Grid\Column|Collection deleted_at * @property Grid\Column|Collection sender * @property Grid\Column|Collection is_email @@ -1153,7 +1153,6 @@ namespace Dcat\Admin { * @property Grid\Column|Collection money_type * @property Grid\Column|Collection source_type * @property Grid\Column|Collection comment - * @property Grid\Column|Collection mm_id * @property Grid\Column|Collection c_attitude * @property Grid\Column|Collection c_service * @property Grid\Column|Collection c_quality @@ -1217,8 +1216,6 @@ namespace Dcat\Admin { * @method Grid\Column|Collection loudspeaker_imei(string $label = null) * @method Grid\Column|Collection dishes_menu_intro(string $label = null) * @method Grid\Column|Collection create_time(string $label = null) - * @method Grid\Column|Collection mp_id(string $label = null) - * @method Grid\Column|Collection money(string $label = null) * @method Grid\Column|Collection parent_id(string $label = null) * @method Grid\Column|Collection order(string $label = null) * @method Grid\Column|Collection icon(string $label = null) @@ -1309,6 +1306,7 @@ namespace Dcat\Admin { * @method Grid\Column|Collection gender(string $label = null) * @method Grid\Column|Collection birthday(string $label = null) * @method Grid\Column|Collection bio(string $label = null) + * @method Grid\Column|Collection money(string $label = null) * @method Grid\Column|Collection score(string $label = null) * @method Grid\Column|Collection successions(string $label = null) * @method Grid\Column|Collection maxsuccessions(string $label = null) @@ -1541,6 +1539,7 @@ namespace Dcat\Admin { * @method Grid\Column|Collection waimai_pay_temp(string $label = null) * @method Grid\Column|Collection dangmian_pay_temp(string $label = null) * @method Grid\Column|Collection ziti_pay_temp(string $label = null) + * @method Grid\Column|Collection mp_id(string $label = null) * @method Grid\Column|Collection deleted_at(string $label = null) * @method Grid\Column|Collection sender(string $label = null) * @method Grid\Column|Collection is_email(string $label = null) @@ -2307,7 +2306,6 @@ namespace Dcat\Admin { * @method Grid\Column|Collection money_type(string $label = null) * @method Grid\Column|Collection source_type(string $label = null) * @method Grid\Column|Collection comment(string $label = null) - * @method Grid\Column|Collection mm_id(string $label = null) * @method Grid\Column|Collection c_attitude(string $label = null) * @method Grid\Column|Collection c_service(string $label = null) * @method Grid\Column|Collection c_quality(string $label = null) @@ -2376,8 +2374,6 @@ namespace Dcat\Admin { * @property Show\Field|Collection loudspeaker_imei * @property Show\Field|Collection dishes_menu_intro * @property Show\Field|Collection create_time - * @property Show\Field|Collection mp_id - * @property Show\Field|Collection money * @property Show\Field|Collection parent_id * @property Show\Field|Collection order * @property Show\Field|Collection icon @@ -2468,6 +2464,7 @@ namespace Dcat\Admin { * @property Show\Field|Collection gender * @property Show\Field|Collection birthday * @property Show\Field|Collection bio + * @property Show\Field|Collection money * @property Show\Field|Collection score * @property Show\Field|Collection successions * @property Show\Field|Collection maxsuccessions @@ -2700,6 +2697,7 @@ namespace Dcat\Admin { * @property Show\Field|Collection waimai_pay_temp * @property Show\Field|Collection dangmian_pay_temp * @property Show\Field|Collection ziti_pay_temp + * @property Show\Field|Collection mp_id * @property Show\Field|Collection deleted_at * @property Show\Field|Collection sender * @property Show\Field|Collection is_email @@ -3466,7 +3464,6 @@ namespace Dcat\Admin { * @property Show\Field|Collection money_type * @property Show\Field|Collection source_type * @property Show\Field|Collection comment - * @property Show\Field|Collection mm_id * @property Show\Field|Collection c_attitude * @property Show\Field|Collection c_service * @property Show\Field|Collection c_quality @@ -3530,8 +3527,6 @@ namespace Dcat\Admin { * @method Show\Field|Collection loudspeaker_imei(string $label = null) * @method Show\Field|Collection dishes_menu_intro(string $label = null) * @method Show\Field|Collection create_time(string $label = null) - * @method Show\Field|Collection mp_id(string $label = null) - * @method Show\Field|Collection money(string $label = null) * @method Show\Field|Collection parent_id(string $label = null) * @method Show\Field|Collection order(string $label = null) * @method Show\Field|Collection icon(string $label = null) @@ -3622,6 +3617,7 @@ namespace Dcat\Admin { * @method Show\Field|Collection gender(string $label = null) * @method Show\Field|Collection birthday(string $label = null) * @method Show\Field|Collection bio(string $label = null) + * @method Show\Field|Collection money(string $label = null) * @method Show\Field|Collection score(string $label = null) * @method Show\Field|Collection successions(string $label = null) * @method Show\Field|Collection maxsuccessions(string $label = null) @@ -3854,6 +3850,7 @@ namespace Dcat\Admin { * @method Show\Field|Collection waimai_pay_temp(string $label = null) * @method Show\Field|Collection dangmian_pay_temp(string $label = null) * @method Show\Field|Collection ziti_pay_temp(string $label = null) + * @method Show\Field|Collection mp_id(string $label = null) * @method Show\Field|Collection deleted_at(string $label = null) * @method Show\Field|Collection sender(string $label = null) * @method Show\Field|Collection is_email(string $label = null) @@ -4620,7 +4617,6 @@ namespace Dcat\Admin { * @method Show\Field|Collection money_type(string $label = null) * @method Show\Field|Collection source_type(string $label = null) * @method Show\Field|Collection comment(string $label = null) - * @method Show\Field|Collection mm_id(string $label = null) * @method Show\Field|Collection c_attitude(string $label = null) * @method Show\Field|Collection c_service(string $label = null) * @method Show\Field|Collection c_quality(string $label = null)