<?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(array $content)
    {
        return Module::where('path',$content['path'])->where('status',$content['status'])->first();
    }

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