<?php


namespace App\Repositories;


use App\TrainingRoom;

class TrainingRoomRepository implements RepositoryInterface
{
    public static function all() {
        return TrainingRoom::all();
    }

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

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

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

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

    public static function sessions($id) {
        return TrainingRoom::findOrFail($id)->trainingSessions;
    }

    public static function box($id) {
        return TrainingRoom::findOrFail($id)->box;
    }
}
