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);
}
}