StocksNew/Modules/Training/app/Repositories/TrainerRepository.php

40 lines
759 B
PHP
Raw Normal View History

2024-08-27 12:03:06 +00:00
<?php
namespace Modules\Training\Repositories;
use Modules\Training\Models\Trainer;
class TrainerRepository implements TrainerInterface
{
public function findAll()
{
return Trainer::get();
}
public function getTrainerById($trainerId)
{
return Trainer::findOrFail($trainerId);
}
public function delete($trainerId)
{
Trainer::destroy($trainerId);
}
public function create(array $trainerDetails)
{
return Trainer::create($trainerDetails);
}
public function update($trainerId, array $newDetails)
{
return Trainer::where('id', $trainerId)->update($newDetails);
}
public function pluck()
{
return Trainer::pluck('first_name','id');
}
}