<?php

namespace App\Repositories\Eloquent;

use App\Models\CourseEnrollment;
use App\Repositories\Contracts\CourseEnrollmentRepositoryInterface;

class CourseEnrollmentRepository implements CourseEnrollmentRepositoryInterface
{
    public function all() {
        return CourseEnrollment::all();
    }

    public function find($id) {
        return CourseEnrollment::findOrFail($id);
    }

    public function create(array $data) {
        return CourseEnrollment::create($data);
    }

    public function update($id, array $data) {
        $courseEnrollment = CourseEnrollment::findOrFail($id);
        $courseEnrollment->update($data);
        return $courseEnrollment;
    }

    public function delete($id) {
        return CourseEnrollment::destroy($id);
    }
}