<?php


namespace App\Repositories;


use App\TrainingWorkoutSection;

class TrainingWorkoutSectionRepository implements RepositoryInterface
{
    public static function all() {
        return TrainingWorkoutSection::all();
    }

    public static function create(array $data){
        //Ja s'ha hagut de comprovar que es admin si en crea un sense box_id....
        return TrainingWorkoutSection::create($data);
    }

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

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

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

    public static function workouts($id) {
        return TrainingWorkoutSection::findOrFail($id)->workouts;
    }

    public static function lines($id) {
        return TrainingWorkoutSection::findOrFail($id)->lines;
    }
}
