action = $action; $this->title_text = $action == 1 ? '审核通过' : '审核拒绝'; $this->title = ' ' . $this->title_text; parent::__construct($title); } /** * Handle the action request. * * @param Request $request * * @return Response */ public function handle(Request $request) { $status = $request->action == 1 ? ProductStatus::ON_SALE : ProductStatus::REFUSE; Product::whereIn('id', $this->getKey())->update(['status' => $status]); return $this->response()->success('操作成功!')->refresh(); } /** * @return string|array|void */ public function confirm() { return "确定要批量{$this->title_text}吗?"; } /** * @return array */ protected function parameters() { return [ 'action' => $this->action, ]; } }