<?php

namespace app\dao;

use App\model\Users;
use App\model\BankLog;
use App\Utils\FunctionResponse;

use App\model\Volunteerservicecorp;

use App\model\Volunteerservicecorpsdetailed;
use App\model\Volunteerjoinrequest;
/**
 * 志愿者服务队Dao层
 */
class VolunteerservicecorpsDao {
    /**
     * 删除志愿者服务队
     * 连带审批记录一起删除
     * @param [type] $groupid
     * @return void
     */
    public static function del($groupid){
        $Volunteerservicecorpsdetailed = Volunteerservicecorpsdetailed::where('groupid', $groupid)->first();
        $Volunteerservicecorpsdetailed->delete();
        $Volunteerservicecorp = Volunteerservicecorp::where('id', $groupid)->first();
        $Volunteerservicecorp->delete();
        $Volunteerjoinrequest=Volunteerjoinrequest::where('groupid', $groupid)->get();
        foreach($Volunteerjoinrequest as $k => $v){
            $v->delete();
        }
    }
}
