|
@@ -0,0 +1,131 @@
|
|
|
|
+<?php
|
|
|
|
+
|
|
|
|
+namespace App\Admin\Controllers\Ask;
|
|
|
|
+
|
|
|
|
+use App\Admin\Repositories\Ask\Askorder;
|
|
|
|
+use App\Wen\Utils\Settings;
|
|
|
|
+use Dcat\Admin\Form;
|
|
|
|
+use Dcat\Admin\Grid;
|
|
|
|
+use Dcat\Admin\Show;
|
|
|
|
+use Dcat\Admin\Http\Controllers\AdminController;
|
|
|
|
+use Illuminate\Http\Request;
|
|
|
|
+
|
|
|
|
+class AskOrderController extends AdminController
|
|
|
|
+{
|
|
|
|
+ public function askorder(Request $request)
|
|
|
|
+ {
|
|
|
|
+ $q = $request->get('q');
|
|
|
|
+ return \App\Models\Ask\Askorder::where('title', 'like', "%$q%")->paginate(null, ['id', 'title as text']);
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * Make a grid builder.
|
|
|
|
+ *
|
|
|
|
+ * @return Grid
|
|
|
|
+ */
|
|
|
|
+ protected function grid()
|
|
|
|
+ {
|
|
|
|
+ return Grid::make(new Askorder(), function (Grid $grid) {
|
|
|
|
+ $grid->simplePaginate();
|
|
|
|
+ $grid->model()->orderBy('id', 'desc');
|
|
|
|
+ $grid->quickSearch(['user_id', 'blogger_user_id','question'])->placeholder('搜索咨询用户ID,答主用户ID');
|
|
|
|
+
|
|
|
|
+ $grid->column('id');
|
|
|
|
+ $grid->column('user_id');
|
|
|
|
+ $grid->column('blogger_user_id');
|
|
|
|
+// $grid->column('question');
|
|
|
|
+ $grid->column('images')->image('',50);
|
|
|
|
+
|
|
|
|
+ $grid->column('ask_price');
|
|
|
|
+ $grid->column('sit_price');
|
|
|
|
+ $grid->column('ask_minute');
|
|
|
|
+ $grid->column('is_hidden')->using([
|
|
|
|
+ 0=>'非匿名',
|
|
|
|
+ 1=>'匿名',
|
|
|
|
+ ]);
|
|
|
|
+ $grid->column('is_public')->using([
|
|
|
|
+ 0=>'不公开',
|
|
|
|
+ 1=>'公开',
|
|
|
|
+ ]);
|
|
|
|
+ $grid->column('eva_score');
|
|
|
|
+ $grid->column('sit_number');
|
|
|
|
+ $grid->column('status')->using([
|
|
|
|
+ 0 =>'待支付',
|
|
|
|
+ 10=>'已支付',
|
|
|
|
+ 20=>'已结束',
|
|
|
|
+ ]);
|
|
|
|
+ $grid->column('createtime');
|
|
|
|
+
|
|
|
|
+ $grid->filter(function (Grid\Filter $filter) {
|
|
|
|
+ $filter->like('question');
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ // 禁用新增按钮
|
|
|
|
+ $grid->disableCreateButton();
|
|
|
|
+ // 禁用编辑按钮
|
|
|
|
+ $grid->disableEditButton();
|
|
|
|
+ // 禁用详情按钮
|
|
|
|
+// $grid->disableViewButton();
|
|
|
|
+ // 禁用删除按钮
|
|
|
|
+ $grid->disableDeleteButton();
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Make a show builder.
|
|
|
|
+ *
|
|
|
|
+ * @param mixed $id
|
|
|
|
+ *
|
|
|
|
+ * @return Show
|
|
|
|
+ */
|
|
|
|
+ protected function detail($id)
|
|
|
|
+ {
|
|
|
|
+ return Show::make($id, new Askorder(), function (Show $show) {
|
|
|
|
+ $show->field('id');
|
|
|
|
+ $show->field('user_id');
|
|
|
|
+ $show->field('blogger_user_id');
|
|
|
|
+ $show->field('question');
|
|
|
|
+// $show->field('images');
|
|
|
|
+ $show->field('ask_price');
|
|
|
|
+ $show->field('sit_price');
|
|
|
|
+ $show->field('ask_minute');
|
|
|
|
+// $show->field('is_hidden');
|
|
|
|
+// $show->field('is_public');
|
|
|
|
+ $show->field('good_number');
|
|
|
|
+ $show->field('eva_score');
|
|
|
|
+ $show->field('eva_content');
|
|
|
|
+// $show->field('eva_time');
|
|
|
|
+ $show->field('sit_number');
|
|
|
|
+// $show->field('status');
|
|
|
|
+// $show->field('createtime');
|
|
|
|
+// $show->field('paytime');
|
|
|
|
+// $show->field('finish_time');
|
|
|
|
+// $show->field('countdown_time');
|
|
|
|
+ $show->field('blogger_rate');
|
|
|
|
+ $show->field('blogger_price');
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Make a form builder.
|
|
|
|
+ *
|
|
|
|
+ * @return Form
|
|
|
|
+ */
|
|
|
|
+ protected function form()
|
|
|
|
+ {
|
|
|
|
+ /*return Form::make(new Askorder(), function (Form $form) {
|
|
|
|
+ $form->display('id');
|
|
|
|
+ $form->text('title')->required();
|
|
|
|
+ $form->image('image')->url('files/uploads')->autoUpload()->required();
|
|
|
|
+ $form->number('sort')->default(0);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ $form->deleting(function (Form $form){
|
|
|
|
+ global $__MINI_GLOBAL_TENANT_ID__;
|
|
|
|
+ if($__MINI_GLOBAL_TENANT_ID__ > 0){
|
|
|
|
+ return $form->response()->error('权限不足,不可以删除其他分站对象');
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ });*/
|
|
|
|
+ }
|
|
|
|
+}
|