34 lines
722 B
PHP
34 lines
722 B
PHP
<?php
|
|
|
|
namespace App\Admin\Actions\Coupon;
|
|
|
|
use Encore\Admin\Actions\RowAction;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class BatchProfit extends RowAction
|
|
{
|
|
public $name = '打款';
|
|
|
|
public function handle(Model $model)
|
|
{
|
|
if ($model->canProfit()) {
|
|
$res = $model->sendMoney();
|
|
if ($res === true) {
|
|
return $this->response()->success('操作成功')->refresh();
|
|
|
|
} else {
|
|
return $this->response()->success($res)->refresh();
|
|
}
|
|
|
|
} else {
|
|
return $this->response()->success('操作失败')->refresh();
|
|
}
|
|
}
|
|
|
|
public function dialog()
|
|
{
|
|
$this->confirm('确定分润?');
|
|
}
|
|
|
|
}
|