Failed.php 844 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace App\Admin\Actions\Community\Docter;
  3. use App\Models\Docter;
  4. use App\Models\DocterOrganization;
  5. use Encore\Admin\Actions\Action;
  6. use Encore\Admin\Actions\RowAction;
  7. use Illuminate\Http\Request;
  8. use Illuminate\Support\Facades\DB;
  9. use Mockery\Exception;
  10. class Failed extends RowAction
  11. {
  12. protected $selector = '.failed';
  13. public $name = '驳回';
  14. public function handle(Request $request)
  15. {
  16. DB::beginTransaction();
  17. try {
  18. DocterOrganization::where('id',$this->row->id)->update(['state'=>2]);
  19. $docter_id = $this->row->docter_id;
  20. Docter::where(['id'=>$docter_id])->update(['is_then'=>0]);
  21. } catch (Exception $e){
  22. return $this->response->error('操作失败');
  23. }
  24. return $this->response->success('操作成功')->refresh();
  25. }
  26. }