<?php

namespace App\Admin\Actions\Service;

use App\Models\Docter;
use Encore\Admin\Actions\RowAction;
use App\Models\Serviceapplys;
use Illuminate\Database\Eloquent\Model;
use PHPUnit\Util\Filter;

class ApplysAction extends RowAction
{
    public $name = '通过';

    public function handle(Model $model)
    {
        // $model ...
        Serviceapplys::where('id',$model->id)->update(['status'=>2]);
        $filter = [1=>'is_chat',2=>'is_phone',3=>'is_appoint'];

        Docter::where('id',$model->docter_id)->update([$filter[$model->service_type]=>1]);

        return $this->response()->success('审核通过')->refresh();
    }

}
