<?php

namespace App\Repositories;

use App\Models\Pendaftar;
use Auth;
use Illuminate\Support\Str;
use Session;
use Storage;
use Uuid;
use DB;

class BiodataRepository
{
    private $model;

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

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

}
