first commit
This commit is contained in:
0
Modules/Training/app/Http/Controllers/.gitkeep
Normal file
0
Modules/Training/app/Http/Controllers/.gitkeep
Normal file
100
Modules/Training/app/Http/Controllers/TrainerController.php
Normal file
100
Modules/Training/app/Http/Controllers/TrainerController.php
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Training\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Modules\Employee\Repositories\EmployeeRepository;
|
||||
use Modules\Training\Repositories\TrainerRepository;
|
||||
|
||||
class TrainerController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
private $employeeRepository;
|
||||
private $trainerRepository;
|
||||
|
||||
|
||||
|
||||
public function __construct(TrainerRepository $trainerRepository, EmployeeRepository $employeeRepository ){
|
||||
$this->employeeRepository = $employeeRepository;
|
||||
$this->trainerRepository = $trainerRepository;
|
||||
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'Trainer Lists';
|
||||
$data['trainerLists'] = $this->trainerRepository->findAll();
|
||||
|
||||
return view ('training::trainer.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create Trainer';
|
||||
$data['editable'] = false;
|
||||
|
||||
return view('training::trainer.create', $data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$this->trainerRepository->create($request->all());
|
||||
toastr()->success('Trainer Created Successfully');
|
||||
return redirect()->route('trainer.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$data['title'] = 'Training Details';
|
||||
$data['item'] = $this->trainerRepository->getTrainerById($id);
|
||||
return view('training::trainer.show', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = 'Edit Leave';
|
||||
$data['editable'] = true;
|
||||
$data['trainer'] = $this->trainerRepository->getTrainerById($id);
|
||||
return view('training::trainer.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
$inputData = $request->all();
|
||||
$this->trainerRepository->update($id, $inputData);
|
||||
toastr()->success('Trainer Updated Succesfully');
|
||||
|
||||
return redirect()->route('trainer.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->trainerRepository->delete($id);
|
||||
toastr()->success('Trainer Deleted Succesfully');
|
||||
}
|
||||
}
|
114
Modules/Training/app/Http/Controllers/TrainingListController.php
Normal file
114
Modules/Training/app/Http/Controllers/TrainingListController.php
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Training\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Modules\Admin\Repositories\DepartmentRepository;
|
||||
use Modules\Employee\Repositories\EmployeeRepository;
|
||||
use Modules\Training\Repositories\TrainerRepository;
|
||||
use Modules\Training\Repositories\TrainingListRepository;
|
||||
|
||||
|
||||
|
||||
class TrainingListController extends Controller
|
||||
{
|
||||
private $trainingListRepository;
|
||||
private $employeeRepository;
|
||||
private $trainerRepository;
|
||||
private $departmentRepository;
|
||||
|
||||
|
||||
public function __construct(TrainingListRepository $trainingListRepository,
|
||||
EmployeeRepository $employeeRepository,
|
||||
TrainerRepository $trainerRepository,
|
||||
DepartmentRepository $departmentRepository )
|
||||
{
|
||||
$this->trainingListRepository = $trainingListRepository;
|
||||
$this->employeeRepository = $employeeRepository;
|
||||
$this->trainerRepository = $trainerRepository;
|
||||
$this->departmentRepository = $departmentRepository;
|
||||
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'Training Lists';
|
||||
$data['trainingLists'] = $this->trainingListRepository->findAll();
|
||||
|
||||
return view('training::training-list.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create Training List';
|
||||
$data['editable'] = false;
|
||||
$data['employee'] = $this->employeeRepository->pluck();
|
||||
$data['trainer'] = $this->trainerRepository->pluck();
|
||||
$data['department'] = $this->departmentRepository->pluck();
|
||||
|
||||
|
||||
return view('training::training-list.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$this->trainingListRepository->create($request->all());
|
||||
toastr()->success('Training List Created Successfully');
|
||||
|
||||
return redirect()->route('trainingList.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$data['title'] = 'Training Details';
|
||||
$data['item'] = $this->trainingListRepository->getTrainingListById($id);
|
||||
|
||||
return view('training::training-list.show', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['editable'] = true;
|
||||
$data['trainingList'] = $this->trainingListRepository->getTrainingListById($id);
|
||||
|
||||
return view('training::training-list.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
$inputData = $request->all();
|
||||
$this->trainingListRepository->update($id, $inputData);
|
||||
toastr()->success('Training List Updated Succesfully');
|
||||
|
||||
return redirect()->route('trading-list.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->trainingListRepository->delete($id);
|
||||
toastr()->success('Training List Deleted Succesfully');
|
||||
}
|
||||
}
|
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Training\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Modules\Training\Repositories\TrainingTypeRepository;
|
||||
|
||||
class TrainingTypeController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
private $trainingTypeRepository;
|
||||
|
||||
public function __construct(TrainingTypeRepository $trainingTypeRepository ){
|
||||
$this->trainingTypeRepository = $trainingTypeRepository;
|
||||
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'Training Type Lists';
|
||||
$data['trainingTypes'] = $this->trainingTypeRepository->findAll();
|
||||
|
||||
return view('training::training-type.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create Training Type';
|
||||
$data['editable'] = false;
|
||||
|
||||
return view('training::training-type.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$this->trainingTypeRepository->create($request->all());
|
||||
toastr()->success('Training Type Created Successfully');
|
||||
return redirect()->route('trainingType.index');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$data['title'] = 'Training Type Details';
|
||||
$data['item'] = $this->trainingTypeRepository->getTrainingTypeById($id);
|
||||
return view('training::training-type.show', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = 'Edit TraingType';
|
||||
$data['editable'] = true;
|
||||
$data['trainer'] = $this->trainingTypeRepository->getTrainingTypeById($id);
|
||||
return view('training::training-type.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
$inputData = $request->all();
|
||||
$this->trainingTypeRepository->update($id, $inputData);
|
||||
toastr()->success('Training Type Updated Succesfully');
|
||||
|
||||
return redirect()->route('training-type.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->trainingTypeRepository->delete($id);
|
||||
toastr()->success('Training Type Deleted Succesfully');
|
||||
}
|
||||
}
|
0
Modules/Training/app/Http/Requests/.gitkeep
Normal file
0
Modules/Training/app/Http/Requests/.gitkeep
Normal file
0
Modules/Training/app/Models/.gitkeep
Normal file
0
Modules/Training/app/Models/.gitkeep
Normal file
36
Modules/Training/app/Models/Trainer.php
Normal file
36
Modules/Training/app/Models/Trainer.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Training\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Training\Database\factories\TrainerFactory;
|
||||
|
||||
class Trainer extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_trainers';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = ['first_name',
|
||||
'middle_name',
|
||||
'last_name',
|
||||
'phone',
|
||||
'email',
|
||||
'address',
|
||||
'shift',
|
||||
'salary',
|
||||
'start_date',
|
||||
'end_date',
|
||||
'status',
|
||||
'remarks',
|
||||
];
|
||||
|
||||
protected static function newFactory(): TrainerFactory
|
||||
{
|
||||
//return TrainerFactory::new();
|
||||
}
|
||||
}
|
53
Modules/Training/app/Models/TrainingList.php
Normal file
53
Modules/Training/app/Models/TrainingList.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Training\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Admin\Models\Department;
|
||||
use Modules\Employee\Models\Employee;
|
||||
use Modules\Training\Database\factories\TrainingListFactory;
|
||||
|
||||
class TrainingList extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'tbl_training_lists';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'training_by',
|
||||
'trainer_id',
|
||||
'assigned_id',
|
||||
'start_date',
|
||||
'end_date',
|
||||
'department_id',
|
||||
'shift',
|
||||
'status',
|
||||
'remarks',
|
||||
];
|
||||
|
||||
protected static function newFactory(): TrainingListFactory
|
||||
{
|
||||
//return TrainingListFactory::new();
|
||||
}
|
||||
|
||||
public function employee()
|
||||
{
|
||||
return $this->belongsTo(Employee::class, 'assigned_id');
|
||||
}
|
||||
|
||||
public function trainer()
|
||||
{
|
||||
return $this->belongsTo(Trainer::class,'trainer_id');
|
||||
}
|
||||
|
||||
public function department()
|
||||
{
|
||||
return $this->belongsTo(Department::class,'department_id');
|
||||
}
|
||||
|
||||
|
||||
}
|
26
Modules/Training/app/Models/TrainingType.php
Normal file
26
Modules/Training/app/Models/TrainingType.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Training\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Training\Database\factories\TrainingTypeFactory;
|
||||
|
||||
class TrainingType extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'tbl_training_types';
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [
|
||||
'training_type',
|
||||
'status',
|
||||
'remarks',
|
||||
];
|
||||
|
||||
protected static function newFactory(): TrainingTypeFactory
|
||||
{
|
||||
//return TrainingTypeFactory::new();
|
||||
}
|
||||
}
|
0
Modules/Training/app/Observers/.gitkeep
Normal file
0
Modules/Training/app/Observers/.gitkeep
Normal file
0
Modules/Training/app/Providers/.gitkeep
Normal file
0
Modules/Training/app/Providers/.gitkeep
Normal file
49
Modules/Training/app/Providers/RouteServiceProvider.php
Normal file
49
Modules/Training/app/Providers/RouteServiceProvider.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Training\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Called before routes are registered.
|
||||
*
|
||||
* Register any model bindings or pattern based filters.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the routes for the application.
|
||||
*/
|
||||
public function map(): void
|
||||
{
|
||||
$this->mapApiRoutes();
|
||||
|
||||
$this->mapWebRoutes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "web" routes for the application.
|
||||
*
|
||||
* These routes all receive session state, CSRF protection, etc.
|
||||
*/
|
||||
protected function mapWebRoutes(): void
|
||||
{
|
||||
Route::middleware('web')->group(module_path('Training', '/routes/web.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "api" routes for the application.
|
||||
*
|
||||
* These routes are typically stateless.
|
||||
*/
|
||||
protected function mapApiRoutes(): void
|
||||
{
|
||||
Route::middleware('api')->prefix('api')->name('api.')->group(module_path('Training', '/routes/api.php'));
|
||||
}
|
||||
}
|
114
Modules/Training/app/Providers/TrainingServiceProvider.php
Normal file
114
Modules/Training/app/Providers/TrainingServiceProvider.php
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Training\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class TrainingServiceProvider extends ServiceProvider
|
||||
{
|
||||
protected string $moduleName = 'Training';
|
||||
|
||||
protected string $moduleNameLower = 'training';
|
||||
|
||||
/**
|
||||
* Boot the application events.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->registerCommands();
|
||||
$this->registerCommandSchedules();
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
$this->loadMigrationsFrom(module_path($this->moduleName, 'database/migrations'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
$this->app->register(RouteServiceProvider::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register commands in the format of Command::class
|
||||
*/
|
||||
protected function registerCommands(): void
|
||||
{
|
||||
// $this->commands([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register command Schedules.
|
||||
*/
|
||||
protected function registerCommandSchedules(): void
|
||||
{
|
||||
// $this->app->booted(function () {
|
||||
// $schedule = $this->app->make(Schedule::class);
|
||||
// $schedule->command('inspire')->hourly();
|
||||
// });
|
||||
}
|
||||
|
||||
/**
|
||||
* Register translations.
|
||||
*/
|
||||
public function registerTranslations(): void
|
||||
{
|
||||
$langPath = resource_path('lang/modules/'.$this->moduleNameLower);
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom($langPath);
|
||||
} else {
|
||||
$this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
*/
|
||||
protected function registerConfig(): void
|
||||
{
|
||||
$this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower.'.php')], 'config');
|
||||
$this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register views.
|
||||
*/
|
||||
public function registerViews(): void
|
||||
{
|
||||
$viewPath = resource_path('views/modules/'.$this->moduleNameLower);
|
||||
$sourcePath = module_path($this->moduleName, 'resources/views');
|
||||
|
||||
$this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower.'-module-views']);
|
||||
|
||||
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
|
||||
|
||||
$componentNamespace = str_replace('/', '\\', config('modules.namespace').'\\'.$this->moduleName.'\\'.ltrim(config('modules.paths.generator.component-class.path'), config('modules.paths.app_folder','')));
|
||||
Blade::componentNamespace($componentNamespace, $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*/
|
||||
public function provides(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
private function getPublishableViewPaths(): array
|
||||
{
|
||||
$paths = [];
|
||||
foreach (config('view.paths') as $path) {
|
||||
if (is_dir($path.'/modules/'.$this->moduleNameLower)) {
|
||||
$paths[] = $path.'/modules/'.$this->moduleNameLower;
|
||||
}
|
||||
}
|
||||
|
||||
return $paths;
|
||||
}
|
||||
}
|
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