123456789101112131415161718192021222324252627282930313233 |
- <?php
- namespace App\Admin\Actions\Community\Docter;
- use App\Models\Docter;
- use App\Models\DocterOrganization;
- use Encore\Admin\Actions\RowAction;
- use Encore\Admin\Grid\Model;
- use Illuminate\Http\Request;
- class Pass extends RowAction
- {
- public $name = '通过';
- public function handle()
- {
- $id = $this->row->id;
- $docter_id = $this->row->docter_id;
- try{
- $DocOrg = new DocterOrganization();
- $DocOrg->where('id',$id)->update(['state'=>1]);
- $count = $DocOrg->where('state','!=',1)->count();
- if($count == 0){
- Docter::where(['id'=>$docter_id])->update(['is_then'=>1]);
- }
- } catch (\Exception $e){
- return $this->response()->error('更新失败!');
- }
- return $this->response()->success('更新成功')->refresh();
- }
- }
|