HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers95/rentman.io/app/Komma/SolutionGroups/Kms/SolutionGroupService.php
<?php

namespace App\Komma\SolutionGroups\Kms;

use App\Komma\Kms\Core\Sections\SectionService;
use App\Komma\SolutionGroups\Models\SolutionGroup;
use Illuminate\Database\Eloquent\Model;

class SolutionGroupService extends SectionService
{
    protected $sortable = false;

    public function __construct()
    {
        $this->forModelName = SolutionGroup::class;

        parent::__construct();
    }

    public function destroyModel(Model $model)
    {
        // Remove the current bind models
        $solutions = $model->solutions;

        foreach ($solutions as $solution) {
            $solution->solution_group_id = null;
            $solution->save();
        }

        parent::destroyModel($model);
    }
}