40 lines
759 B
PHP
40 lines
759 B
PHP
|
<?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');
|
||
|
}
|
||
|
|
||
|
}
|