<?php

namespace Modules\User\Repositories;

use App\Models\UserModule;
use Illuminate\Http\Request;
use Modules\User\Interfaces\ModuleRepositoryInterface;
use Modules\User\Models\Module;

class ModuleRepository implements ModuleRepositoryInterface
{
    public function get(array $request)
    {
        return Module::query();
    }

    public function getItemByPath(string $path)
    {
        return Module::where('path',$path)->first();
    }

    public function checkModuleAccess(int $module_id , int $user_id)
    {
        return UserModule::query()
                ->where('module_id',$module_id)
                ->where('user_id',$user_id)
                ->first();
    }
}
