belongsTo(CharacterList::class,'list_id'); } public function character(){ $this->belongsTo(Character::class,'character_id'); } public static function deleteOrphans(){ $items = static::all(); foreach($items as $item){ try{ $item->list; }catch(LogicException $e){ $item->delete(); } } } }