This repository has been archived on 2020-11-09. You can view files and clone it, but cannot push or open issues or pull requests.
Files
pingan/app/Admin/Actions/Coupon/BatchProfits.php
2020-08-06 16:37:53 +08:00

34 lines
710 B
PHP

<?php
namespace App\Admin\Actions\Coupon;
use Encore\Admin\Actions\BatchAction;
use Illuminate\Database\Eloquent\Collection;
class BatchProfits extends BatchAction
{
public $name = '批量打款';
public function handle(Collection $collection)
{
$success = $error = 0;
foreach ($collection as $model) {
$res = $model->sendMoney();
if ($res === true) {
$success++;
} else {
$error++;
}
}
return $this->response()->success('成功' . $success . '条,失败' . $error . '条')->refresh();
}
public function dialog()
{
$this->confirm('确定打款?');
}
}