<?php

namespace App\Repositories\Admin;

use App\Models\Admin\MsJabatan;
use App\Repositories\Repository;

class MsJabatanRepository extends Repository
{
    protected $model;

    public function __construct(MsJabatan $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();
    }
}
