1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- namespace App\Admin\Actions\Community\Docter;
- use App\Models\CdmsUsers;
- 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;
- $org_id = $this->row->organization_id;
- $docter_id = $this->row->docter_id;
- $name = $this->row->docter->name;
- try{
- $DocOrg = new DocterOrganization();
- $DocOrg->where('id',$id)->update(['state'=>1]);
- // $count = $DocOrg->where('state','!=',1)->where('docter_id',$docter_id)->count();
- // if($count == 0){
- // Docter::where(['id'=>$docter_id])->update(['is_then'=>1]);
- // $user_name = $this->randomkeys(8);
- // $data['username'] = $user_name;
- // $data['name'] = $name;
- // $data['password'] = bcrypt('123456');
- // $data['org_id'] = $org_id;
- // $data['docter_id'] = $docter_id;
- // CdmsUsers::insert($data);
- // }
- } catch (\Exception $e){
- return $this->response()->error('更新失败!');
- }
- return $this->response()->success('更新成功')->refresh();
- }
- function randomkeys($length)
- {
- $key = '';
- $pattern = '1234567890abcdefghijklmnopqrstuvwxyz
- ABCDEFGHIJKLOMNOPQRSTUVWXYZ';
- for($i=0;$i<$length;$i++)
- {
- $key .= $pattern{mt_rand(0,35)}; //生成php随机数
- }
- return $key;
- }
- }
|