Files
water-back/modules/Withdraw/Http/Controllers/Admin/Actions/WithdrawAudit.php
2023-01-12 14:47:38 +08:00

49 lines
1.2 KiB
PHP

<?php
namespace Modules\Withdraw\Http\Controllers\Admin\Actions;
use Encore\Admin\Actions\RowAction;
use Encore\Admin\Facades\Admin;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\Request;
use Modules\Withdraw\Models\Withdraw;
class WithdrawAudit extends RowAction
{
public $name = '提现审核';
public function handle(Withdraw $withdraw, Request $request)
{
$status = $request->status;
$remark = $request->remark;
try {
if ($status == Withdraw::STATUS_PASS) {
$withdraw->pass($remark);
}
if ($status == Withdraw::STATUS_REJECT) {
$withdraw->reject($remark);
}
return $this->response()->success('操作成功')->refresh();
} catch (\Exception $e) {
return $this->response()->error($e->getMessage())->refresh();
}
}
public function form(Model $model)
{
$this->select('status', '状态')
->options([
Withdraw::STATUS_PASS => '通过',
Withdraw::STATUS_REJECT => '驳回',
])
->required();
$this->text('remark', '说明');
}
}