<?php

namespace App\Repositories\Eloquent;

use App\Models\Milestone;
use App\Repositories\Contracts\MilestoneRepositoryInterface;

class MilestoneRepository implements MilestoneRepositoryInterface
{
    public function all() {
        return Milestone::all();
    }

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

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

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

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