first commit
This commit is contained in:
0
Modules/Training/app/Repositories/.gitkeep
Normal file
0
Modules/Training/app/Repositories/.gitkeep
Normal file
12
Modules/Training/app/Repositories/TrainerInterface.php
Normal file
12
Modules/Training/app/Repositories/TrainerInterface.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Training\Repositories;
|
||||
|
||||
interface TrainerInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getTrainerById($trainerId);
|
||||
public function delete($trainerId);
|
||||
public function create(array $trainerDetails);
|
||||
public function update($trainerId, array $newDetails);
|
||||
}
|
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');
|
||||
}
|
||||
|
||||
}
|
12
Modules/Training/app/Repositories/TrainingListInterface.php
Normal file
12
Modules/Training/app/Repositories/TrainingListInterface.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Training\Repositories;
|
||||
|
||||
interface TrainingListInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getTrainingListById($trainingListId);
|
||||
public function delete($trainingListId);
|
||||
public function create(array $trainingListDetails);
|
||||
public function update($trainingListId, array $newDetails);
|
||||
}
|
34
Modules/Training/app/Repositories/TrainingListRepository.php
Normal file
34
Modules/Training/app/Repositories/TrainingListRepository.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Training\Repositories;
|
||||
|
||||
use Modules\Training\Models\TrainingList;
|
||||
|
||||
class TrainingListRepository implements TrainingListInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return TrainingList::get();
|
||||
}
|
||||
|
||||
public function getTrainingListById($trainingListId)
|
||||
{
|
||||
return TrainingList::findOrFail($trainingListId);
|
||||
}
|
||||
|
||||
public function delete($trainingListId)
|
||||
{
|
||||
TrainingList::destroy($trainingListId);
|
||||
}
|
||||
|
||||
public function create(array $trainingListDetails)
|
||||
{
|
||||
return TrainingList::create($trainingListDetails);
|
||||
}
|
||||
|
||||
public function update($trainingListId, array $newDetails)
|
||||
{
|
||||
return TrainingList::where('trainingList_id', $trainingListId)->update($newDetails);
|
||||
}
|
||||
|
||||
}
|
12
Modules/Training/app/Repositories/TrainingTypeInterface.php
Normal file
12
Modules/Training/app/Repositories/TrainingTypeInterface.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Training\Repositories;
|
||||
|
||||
interface TrainingTypeInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getTrainingTypeById($trainingTypeId);
|
||||
public function delete($trainingTypeId);
|
||||
public function create(array $trainingTypeDetails);
|
||||
public function update($trainingTypeId, array $newDetails);
|
||||
}
|
34
Modules/Training/app/Repositories/TrainingTypeRepository.php
Normal file
34
Modules/Training/app/Repositories/TrainingTypeRepository.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Training\Repositories;
|
||||
|
||||
use Modules\Training\Models\TrainingType;
|
||||
|
||||
class TrainingTypeRepository implements TrainingTypeInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return TrainingType::get();
|
||||
}
|
||||
|
||||
public function getTrainingTypeById($trainingTypeId)
|
||||
{
|
||||
return TrainingType::findOrFail($trainingTypeId);
|
||||
}
|
||||
|
||||
public function delete($trainingTypeId)
|
||||
{
|
||||
TrainingType::destroy($trainingTypeId);
|
||||
}
|
||||
|
||||
public function create(array $trainingTypeDetails)
|
||||
{
|
||||
return TrainingType::create($trainingTypeDetails);
|
||||
}
|
||||
|
||||
public function update($trainingTypeId, array $newDetails)
|
||||
{
|
||||
return TrainingType::where('TrainingType_id', $trainingTypeId)->update($newDetails);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user