<?php


namespace App\Repositories;

use App\Equipment;

class EquipmentRepository implements RepositoryInterface
{
    public static function all() {
        return Equipment::all();
    }

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

    public static function update(array $data, $id){
        Equipment::findOrFail($id)->update($data);
        return Equipment::findOrFail($id);
    }

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

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

    public static function findByName($name){
        return Equipment::where('name','=',$name)->first();
    }
}
