<?php

namespace App\Modules\Sales\Repositories;

use App\Modules\Sales\Models\SalesReturn;

class SalesReturnRepository
{
    public function lockByIdForTenant(int $tenantId, int $id): ?SalesReturn
    {
        return SalesReturn::withoutGlobalScopes()
            ->where('tenant_id', $tenantId)
            ->whereKey($id)
            ->lockForUpdate()
            ->first();
    }

    public function save(SalesReturn $salesReturn): void
    {
        $salesReturn->save();
    }
}
