最新版本
This commit is contained in:
@@ -9,4 +9,20 @@ class Companys extends Model
|
||||
{
|
||||
protected $table = 'companys';
|
||||
|
||||
public function companyoperators()
|
||||
{
|
||||
return $this->hasMany(CompanyOperators::class, 'company_id', 'id');
|
||||
}
|
||||
|
||||
|
||||
public static function customDelete($id)
|
||||
{
|
||||
$companyAndOperators = self::with(['companyoperators'])->where('id', $id)->find();
|
||||
if (!$companyAndOperators) {
|
||||
return false;
|
||||
}
|
||||
$companyAndOperators->companyoperators()->delete();
|
||||
$companyAndOperators->delete();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user