<?php

namespace App\Classes\Modules\Addresses\Services;

use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Classes\General\Interfaces\Addressable;
use App\Models\Address;
use App\Models\CompanyModule;

class ResetsAddressesDefault extends AbstractUpdateRecord
{

    /**
     * @param Addressable $addressable
     * @param int $type
     * @return void
     */
    public function execute(Addressable $addressable, int $type)
    {
        $addressable->addresses()->where('type', $type)->update(['default' => false]);
    }
}
