2024-04-23 14:52:49 +04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
|
|
|
use App\Http\Controllers\GradeController;
|
2024-05-07 12:14:18 +04:00
|
|
|
use App\Http\Controllers\GradeSubjectController;
|
2024-05-07 15:05:10 +04:00
|
|
|
use App\Http\Controllers\GradeTeacherController;
|
2024-04-23 14:52:49 +04:00
|
|
|
use App\Http\Controllers\StudentController;
|
|
|
|
use App\Http\Controllers\SubjectController;
|
2024-05-06 17:47:25 +04:00
|
|
|
use App\Http\Controllers\SubjectTeacherController;
|
2024-04-23 14:52:49 +04:00
|
|
|
use App\Http\Controllers\TeacherController;
|
|
|
|
use App\Services\GradeService;
|
2024-05-07 12:14:18 +04:00
|
|
|
use App\Services\GradeSubjectService;
|
2024-05-07 15:05:10 +04:00
|
|
|
use App\Services\GradeTeacherService;
|
2024-04-23 14:52:49 +04:00
|
|
|
use App\Services\ServiceInterface;
|
|
|
|
use App\Services\StudentService;
|
|
|
|
use App\Services\SubjectService;
|
2024-05-06 17:47:25 +04:00
|
|
|
use App\Services\SubjectTeacherService;
|
2024-04-23 14:52:49 +04:00
|
|
|
use App\Services\TeacherService;
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
|
|
|
|
class ModelServiceProvider extends ServiceProvider
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Register services.
|
|
|
|
*/
|
|
|
|
public function register(): void
|
|
|
|
{
|
|
|
|
$this->app->when(StudentController::class)
|
|
|
|
->needs(ServiceInterface::class)
|
|
|
|
->give(function () {
|
|
|
|
return new StudentService();
|
|
|
|
});
|
|
|
|
|
|
|
|
$this->app->when(TeacherController::class)
|
|
|
|
->needs(ServiceInterface::class)
|
|
|
|
->give(function () {
|
|
|
|
return new TeacherService();
|
|
|
|
});
|
|
|
|
|
|
|
|
$this->app->when(GradeController::class)
|
|
|
|
->needs(ServiceInterface::class)
|
|
|
|
->give(function () {
|
|
|
|
return new GradeService();
|
|
|
|
});
|
|
|
|
|
|
|
|
$this->app->when(SubjectController::class)
|
|
|
|
->needs(ServiceInterface::class)
|
|
|
|
->give(function () {
|
|
|
|
return new SubjectService();
|
|
|
|
});
|
2024-05-06 17:47:25 +04:00
|
|
|
|
|
|
|
$this->app->when(SubjectTeacherController::class)
|
|
|
|
->needs(ServiceInterface::class)
|
|
|
|
->give(function () {
|
|
|
|
return new SubjectTeacherService();
|
|
|
|
});
|
2024-05-07 12:14:18 +04:00
|
|
|
|
|
|
|
$this->app->when(GradeSubjectController::class)
|
|
|
|
->needs(ServiceInterface::class)
|
|
|
|
->give(function () {
|
|
|
|
return new GradeSubjectService();
|
|
|
|
});
|
2024-05-07 15:05:10 +04:00
|
|
|
|
|
|
|
$this->app->when(GradeTeacherController::class)
|
|
|
|
->needs(ServiceInterface::class)
|
|
|
|
->give(function () {
|
|
|
|
return new GradeTeacherService();
|
|
|
|
});
|
2024-04-23 14:52:49 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Bootstrap services.
|
|
|
|
*/
|
|
|
|
public function boot(): void
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
}
|