<?php

namespace App\Repositries;

use App\Models\RoomItem;

class ItemRepository
{
    public $mainRepositry;
    public $model;
    public function __construct(MainRepository $mainRepositry, RoomItem $model)
    {
        $this->mainRepositry = $mainRepositry;
        $this->model = $model->with(['activOffer']);
    }
    public function index($per_page = null, array $filters = [])
    {
        $filters = count($filters) ? $filters : request()->all();
        return $this->mainRepositry->index($this->model->filter($filters), $per_page);
    }

    public function show($id)
    {
        $item = $this->mainRepositry->show($this->model->filter(), $id)->load('room', 'room.category.parent', 'room.type', 'rates', 'category.parent', 'type');
        return $item;
    }
}
