<?php

namespace App\Repositories\User;

use App\Models\User\BukuAjar;
use App\Repositories\Repository;

class BukuAjarRepository extends Repository
{
    protected $model;

    public function __construct(BukuAjar $model)
    {
        $this->model = $model;
    }

    public function get($with = null, $search = null, $id = null)
    {
        return $this->model->when($with, function ($query) use ($with) {
            return $query->with($with);
        })
            ->when($search, function ($query) use ($search) {
                return $query->where('search', $search);
            })
            ->when($id, function ($query) use ($id) {
                return $query->where('id', $id);
            })
            ->get();
    }

}
