1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- namespace App\Admin\Actions;
- use App\Models\Order;
- use Dcat\Admin\Contracts\LazyRenderable;
- use Dcat\Admin\Traits\LazyWidget;
- use Dcat\Admin\Widgets\Form;
- class SendOrderForm extends Form implements LazyRenderable
- {
- use LazyWidget; //0审核中, 1进行中,2不通过, 3已完成
- //弹窗表单
- public function form()
- {
- $id = isset($this->payload['id']) ? $this->payload['id'] : 0;
- $this->hidden('id')->value($id);
- $this->radio('is_send', '')->options([
- 1=>'发货'
- ])->default(1);
- }
- //点击表单处理
- public function handle(array $input)
- {
- $is_send = $input['is_send'];
- try {
- $order = Order::find($input['id']);
- if ($is_send > 0) {
- $order->is_send = $is_send;
- $order->save();
- }
- } catch (\Exception $exception) {
- return $this->response()->error($exception->getMessage());
- }
- return $this->response()->success('success')->refresh();
- }
- }
|