<?php


namespace App\Repositories;

use App\ExerciseType;

class ExerciseTypeRepository implements RepositoryInterface
{
    public static function all() {
        return ExerciseType::all();
    }

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

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

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

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

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