1234567891011121314151617181920212223242526272829303132 |
- <?php
- namespace App\Admin\Actions\Community\Docter;
- use App\Models\Docter;
- use App\Models\DocterOrganization;
- use Encore\Admin\Actions\Action;
- use Encore\Admin\Actions\RowAction;
- use Illuminate\Http\Request;
- use Illuminate\Support\Facades\DB;
- use Mockery\Exception;
- class Failed extends RowAction
- {
- protected $selector = '.failed';
- public $name = '驳回';
- public function handle()
- {
- DB::beginTransaction();
- try {
- DocterOrganization::where('id',$this->row->id)->update(['state'=>2]);
- $docter_id = $this->row->docter_id;
- Docter::where(['id'=>$docter_id])->update(['is_then'=>0]);
- DB::commit();
- } catch (Exception $e){
- DB::rollBack();
- return $this->response()->error('操作失败');
- }
- return $this->response()->success('操作成功')->refresh();
- }
- }
|