<?php

namespace Modules\PaymentLog\Repositories;

use Illuminate\Http\Request;
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
use Modules\PaymentLog\Interfaces\PaymentLogRepositoryInterface;
use Modules\PaymentLog\Models\PaymentLog;
use Modules\PaymentLog\Models\PaymentLogDescription;

class PaymentLogRepository implements PaymentLogRepositoryInterface
{
    public function get(array $request)
    {
        return PaymentLog::query();
    }

    public function getItem(int $id)
    {
        return PaymentLog::find($id);
    }

    public function checkItem(int $id)
    {
        return PaymentLog::find($id);
    }

    public function getItemTrashed(int $id)
    {
        $paymentLog = PaymentLog::onlyTrashed()->find($id);
        return $paymentLog ;
    }

    public function create(array $request): PaymentLog
    {
        $paymentLog = PaymentLog::create($request);
        return $paymentLog;
    }

    public function update(array $request, ?PaymentLog $paymentLog): PaymentLog
    {
        $paymentLog->update($request);

        return $paymentLog;
    }

    /**
     * Remove the specified paymentLog from storage.
     * @param PaymentLog $paymentLog
     * @return void
     */
    public function destroy(PaymentLog $paymentLog) :void
    {
        $paymentLog->delete();
    }

    /**
     * Remove several cities by IDs.
     *
     * @param array $request
     * @return void
     */
    public function destroyAll(array $ids) :void
    {
         PaymentLog::whereIn('id', $ids)->delete();
    }

    /**
     * Restore the specified paymentLog from storage.
     *
     * @param PaymentLog $paymentLog
     * @return void
     */
    public function restore(PaymentLog $paymentLog) :void
    {
        $paymentLog->restore();
    }

    /**
     * Restore several cities by IDs.
     *
     * @param array $request
     * @return void
     */
    public function restoreAll(array $ids) :void
    {
        PaymentLog::whereIn('id', $ids)->onlyTrashed()->restore();
    }
}
