first commit
This commit is contained in:
39
Modules/Training/app/Repositories/TrainerRepository.php
Normal file
39
Modules/Training/app/Repositories/TrainerRepository.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?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');
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user