From dc65c4ceec77e4c53b07da35c738168159b8e180 Mon Sep 17 00:00:00 2001 From: Krzysztof Rewak Date: Wed, 21 Aug 2024 13:36:24 +0200 Subject: [PATCH 1/4] - namespaces and facades clean-up (#125) * - namespaces and facades clean-up * - aftermerge --- app/Actions/ActivateSemesterAction.php | 4 +- app/Actions/WuStudentsImport.php | 4 +- app/Console/Commands/FlushCachedPageTitle.php | 2 +- app/DTOs/StudentData.php | 8 ++-- app/Enums/ClassType.php | 2 +- app/Enums/Icons.php | 2 +- app/Enums/SectionType.php | 2 +- app/Enums/SemesterName.php | 2 +- app/Enums/StudyForm.php | 2 +- app/Http/Controllers/Controller.php | 2 +- .../Dashboard/ContactInfoController.php | 11 +++-- .../Dashboard/CourseController.php | 21 +++++---- .../Dashboard/CourseSemesterController.php | 19 ++++---- .../Dashboard/DashboardController.php | 15 +++---- .../Controllers/Dashboard/FaqController.php | 9 ++-- .../Controllers/Dashboard/FieldController.php | 9 ++-- .../Controllers/Dashboard/GradeController.php | 21 +++++---- .../Controllers/Dashboard/GroupController.php | 11 +++-- .../Dashboard/GroupStudentController.php | 13 +++--- .../Dashboard/LogoutController.php | 12 +++-- .../Dashboard/NewsManagementController.php | 9 ++-- .../Dashboard/PasswordUpdateController.php | 11 +++-- .../Dashboard/SectionController.php | 13 +++--- .../Dashboard/SectionSettingsController.php | 7 ++- .../Dashboard/SemesterController.php | 11 +++-- .../Dashboard/SettingController.php | 22 +++++----- .../Dashboard/StudentController.php | 13 +++--- .../Controllers/Public/CourseController.php | 11 +++-- .../Controllers/Public/GradeController.php | 15 +++---- .../Controllers/Public/HomeController.php | 11 +++-- .../Controllers/Public/LoginController.php | 11 +++-- .../Controllers/Public/NewsController.php | 7 ++- app/Http/Middleware/HandleInertiaRequests.php | 2 +- app/Http/Requests/ContactInfoRequest.php | 4 +- app/Http/Requests/CourseRequest.php | 6 +-- app/Http/Requests/CourseSemesterRequest.php | 2 +- app/Http/Requests/FaqRequest.php | 2 +- app/Http/Requests/FieldRequest.php | 2 +- app/Http/Requests/GroupRequest.php | 4 +- app/Http/Requests/NewsRequest.php | 2 +- app/Http/Requests/SectionRequest.php | 4 +- app/Http/Requests/SemesterRequest.php | 2 +- app/Http/Requests/SettingRequest.php | 2 +- app/Http/Requests/StoreStudentRequest.php | 2 +- app/Http/Requests/UpdateGrade.php | 2 +- app/Http/Requests/UpdateGradeColumn.php | 2 +- app/Http/Requests/UpdateStudentRequest.php | 2 +- app/Http/Resources/CoursePublicResource.php | 8 ++-- app/Http/Resources/CourseResource.php | 6 +-- app/Http/Resources/CourseSemesterResource.php | 4 +- app/Http/Resources/FieldResource.php | 4 +- app/Http/Resources/GroupResource.php | 6 +-- app/Models/ContactInfo.php | 2 +- app/Models/Course.php | 4 +- app/Models/CourseSemester.php | 2 +- app/Models/Faq.php | 2 +- app/Models/Field.php | 2 +- app/Models/Grade.php | 4 +- app/Models/GradeColumn.php | 4 +- app/Models/Group.php | 4 +- app/Models/News.php | 6 +-- app/Models/Section.php | 4 +- app/Models/SectionSettings.php | 2 +- app/Models/Semester.php | 2 +- app/Models/Setting.php | 2 +- app/Models/Student.php | 2 +- app/Models/User.php | 2 +- app/Observers/CourseObserver.php | 6 +-- app/Observers/GradeColumnObserver.php | 4 +- app/Observers/GradeObserver.php | 4 +- app/Observers/NewsObserver.php | 6 +-- app/Providers/BuilderServiceProvider.php | 2 +- app/Providers/EventServiceProvider.php | 2 +- app/Providers/ViewServiceProvider.php | 4 +- app/Traits/Sluggable.php | 2 +- bootstrap/app.php | 2 +- bootstrap/providers.php | 4 +- composer.json | 2 +- config/auth.php | 2 +- database/factories/ContactInfoFactory.php | 4 +- database/factories/CourseFactory.php | 6 +-- database/factories/CourseSemesterFactory.php | 4 +- database/factories/FaqFactory.php | 2 +- database/factories/GradeColumnFactory.php | 2 +- database/factories/GradeFactory.php | 4 +- database/factories/GroupFactory.php | 4 +- database/factories/SectionFactory.php | 2 +- database/factories/UserFactory.php | 2 +- database/seeders/DatabaseSeeder.php | 18 ++++---- database/seeders/DemoSeeder.php | 2 +- routes/web.php | 44 +++++++++---------- tests/Feature/ContactInfoTest.php | 6 +-- tests/Feature/CourseSemesterTest.php | 8 ++-- tests/Feature/CourseTest.php | 6 +-- tests/Feature/ExampleTest.php | 4 +- tests/Feature/FaqTest.php | 4 +- tests/Feature/FieldTest.php | 4 +- tests/Feature/GradeColumnTest.php | 6 +-- tests/Feature/GradePageTest.php | 14 +++--- tests/Feature/GradeTest.php | 8 ++-- tests/Feature/GroupTest.php | 8 ++-- tests/Feature/LoginTest.php | 2 +- tests/Feature/LogoutTest.php | 2 +- tests/Feature/NewsSlugTest.php | 2 +- tests/Feature/NewsTest.php | 4 +- tests/Feature/PasswordUpdateTest.php | 2 +- tests/Feature/SectionsTest.php | 6 +-- tests/Feature/SemesterTest.php | 4 +- tests/Feature/SettingsTest.php | 4 +- tests/Feature/StudentImportTest.php | 4 +- tests/Feature/StudentTest.php | 4 +- tests/Feature/UnaccentSearchTest.php | 4 +- 112 files changed, 321 insertions(+), 343 deletions(-) diff --git a/app/Actions/ActivateSemesterAction.php b/app/Actions/ActivateSemesterAction.php index c960edd..d4a1afb 100644 --- a/app/Actions/ActivateSemesterAction.php +++ b/app/Actions/ActivateSemesterAction.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace App\Actions; +namespace Keating\Actions; -use App\Models\Semester; use Exception; use Illuminate\Database\ConnectionInterface; +use Keating\Models\Semester; class ActivateSemesterAction { diff --git a/app/Actions/WuStudentsImport.php b/app/Actions/WuStudentsImport.php index 674c125..4b9342c 100644 --- a/app/Actions/WuStudentsImport.php +++ b/app/Actions/WuStudentsImport.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace App\Actions; +namespace Keating\Actions; -use App\Models\Student; +use Keating\Models\Student; class WuStudentsImport { diff --git a/app/Console/Commands/FlushCachedPageTitle.php b/app/Console/Commands/FlushCachedPageTitle.php index 332808b..d91f85b 100644 --- a/app/Console/Commands/FlushCachedPageTitle.php +++ b/app/Console/Commands/FlushCachedPageTitle.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Console\Commands; +namespace Keating\Console\Commands; use Illuminate\Cache\CacheManager; use Illuminate\Console\Command; diff --git a/app/DTOs/StudentData.php b/app/DTOs/StudentData.php index 33eba4f..7bd1c60 100644 --- a/app/DTOs/StudentData.php +++ b/app/DTOs/StudentData.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace App\DTOs; +namespace Keating\DTOs; -use App\Models\Grade; -use App\Models\GradeColumn; -use App\Models\Student; use Illuminate\Support\Collection; +use Keating\Models\Grade; +use Keating\Models\GradeColumn; +use Keating\Models\Student; readonly class StudentData { diff --git a/app/Enums/ClassType.php b/app/Enums/ClassType.php index 4455c52..dbcc465 100644 --- a/app/Enums/ClassType.php +++ b/app/Enums/ClassType.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Enums; +namespace Keating\Enums; enum ClassType: string { diff --git a/app/Enums/Icons.php b/app/Enums/Icons.php index cc6d376..feb856c 100644 --- a/app/Enums/Icons.php +++ b/app/Enums/Icons.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Enums; +namespace Keating\Enums; enum Icons: string { diff --git a/app/Enums/SectionType.php b/app/Enums/SectionType.php index 2071647..49ec311 100644 --- a/app/Enums/SectionType.php +++ b/app/Enums/SectionType.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Enums; +namespace Keating\Enums; enum SectionType: string { diff --git a/app/Enums/SemesterName.php b/app/Enums/SemesterName.php index 6cb04d1..8bfe5f9 100644 --- a/app/Enums/SemesterName.php +++ b/app/Enums/SemesterName.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Enums; +namespace Keating\Enums; enum SemesterName: string { diff --git a/app/Enums/StudyForm.php b/app/Enums/StudyForm.php index 529388b..12f1e7b 100644 --- a/app/Enums/StudyForm.php +++ b/app/Enums/StudyForm.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Enums; +namespace Keating\Enums; enum StudyForm: string { diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 7437400..f67b1e2 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Http\Controllers; +namespace Keating\Http\Controllers; use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Foundation\Validation\ValidatesRequests; diff --git a/app/Http/Controllers/Dashboard/ContactInfoController.php b/app/Http/Controllers/Dashboard/ContactInfoController.php index 83b3e6c..aa09d34 100644 --- a/app/Http/Controllers/Dashboard/ContactInfoController.php +++ b/app/Http/Controllers/Dashboard/ContactInfoController.php @@ -2,18 +2,17 @@ declare(strict_types=1); -namespace App\Http\Controllers\Dashboard; +namespace Keating\Http\Controllers\Dashboard; -use App\Enums\Icons; -use App\Http\Controllers\Controller; -use App\Http\Requests\ContactInfoRequest; -use App\Models\ContactInfo; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Inertia\Response; +use Keating\Enums\Icons; +use Keating\Http\Requests\ContactInfoRequest; +use Keating\Models\ContactInfo; use Spatie\LaravelOptions\Options; -class ContactInfoController extends Controller +class ContactInfoController { public function index(Request $request): Response { diff --git a/app/Http/Controllers/Dashboard/CourseController.php b/app/Http/Controllers/Dashboard/CourseController.php index 590cc88..aa793a4 100644 --- a/app/Http/Controllers/Dashboard/CourseController.php +++ b/app/Http/Controllers/Dashboard/CourseController.php @@ -2,22 +2,21 @@ declare(strict_types=1); -namespace App\Http\Controllers\Dashboard; +namespace Keating\Http\Controllers\Dashboard; -use App\Enums\ClassType; -use App\Enums\SemesterName; -use App\Enums\StudyForm; -use App\Http\Controllers\Controller; -use App\Http\Requests\CourseRequest; -use App\Http\Resources\CourseResource; -use App\Http\Resources\FieldResource; -use App\Models\Course; -use App\Models\Field; use Illuminate\Http\RedirectResponse; use Inertia\Response; +use Keating\Enums\ClassType; +use Keating\Enums\SemesterName; +use Keating\Enums\StudyForm; +use Keating\Http\Requests\CourseRequest; +use Keating\Http\Resources\CourseResource; +use Keating\Http\Resources\FieldResource; +use Keating\Models\Course; +use Keating\Models\Field; use Spatie\LaravelOptions\Options; -class CourseController extends Controller +class CourseController { public function index(): Response { diff --git a/app/Http/Controllers/Dashboard/CourseSemesterController.php b/app/Http/Controllers/Dashboard/CourseSemesterController.php index 3f5f37a..a9648bb 100644 --- a/app/Http/Controllers/Dashboard/CourseSemesterController.php +++ b/app/Http/Controllers/Dashboard/CourseSemesterController.php @@ -2,21 +2,20 @@ declare(strict_types=1); -namespace App\Http\Controllers\Dashboard; +namespace Keating\Http\Controllers\Dashboard; -use App\Enums\StudyForm; -use App\Http\Controllers\Controller; -use App\Http\Requests\CourseSemesterRequest; -use App\Http\Resources\CourseSemesterResource; -use App\Http\Resources\GroupResource; -use App\Models\Course; -use App\Models\CourseSemester; -use App\Models\Semester; use Illuminate\Http\RedirectResponse; use Inertia\Response; +use Keating\Enums\StudyForm; +use Keating\Http\Requests\CourseSemesterRequest; +use Keating\Http\Resources\CourseSemesterResource; +use Keating\Http\Resources\GroupResource; +use Keating\Models\Course; +use Keating\Models\CourseSemester; +use Keating\Models\Semester; use Spatie\LaravelOptions\Options; -class CourseSemesterController extends Controller +class CourseSemesterController { public function index(): Response { diff --git a/app/Http/Controllers/Dashboard/DashboardController.php b/app/Http/Controllers/Dashboard/DashboardController.php index 90c2441..321fb1d 100644 --- a/app/Http/Controllers/Dashboard/DashboardController.php +++ b/app/Http/Controllers/Dashboard/DashboardController.php @@ -2,17 +2,16 @@ declare(strict_types=1); -namespace App\Http\Controllers\Dashboard; +namespace Keating\Http\Controllers\Dashboard; -use App\Http\Controllers\Controller; -use App\Models\Course; -use App\Models\Group; -use App\Models\Semester; -use App\Models\Setting; -use App\Models\Student; use Inertia\Response; +use Keating\Models\Course; +use Keating\Models\Group; +use Keating\Models\Semester; +use Keating\Models\Setting; +use Keating\Models\Student; -class DashboardController extends Controller +class DashboardController { public function __invoke(): Response { diff --git a/app/Http/Controllers/Dashboard/FaqController.php b/app/Http/Controllers/Dashboard/FaqController.php index 0234de2..dd7d6b7 100644 --- a/app/Http/Controllers/Dashboard/FaqController.php +++ b/app/Http/Controllers/Dashboard/FaqController.php @@ -2,15 +2,14 @@ declare(strict_types=1); -namespace App\Http\Controllers\Dashboard; +namespace Keating\Http\Controllers\Dashboard; -use App\Http\Controllers\Controller; -use App\Http\Requests\FaqRequest; -use App\Models\Faq; use Illuminate\Http\RedirectResponse; use Inertia\Response; +use Keating\Http\Requests\FaqRequest; +use Keating\Models\Faq; -class FaqController extends Controller +class FaqController { public function index(): Response { diff --git a/app/Http/Controllers/Dashboard/FieldController.php b/app/Http/Controllers/Dashboard/FieldController.php index a843508..49f014d 100644 --- a/app/Http/Controllers/Dashboard/FieldController.php +++ b/app/Http/Controllers/Dashboard/FieldController.php @@ -2,15 +2,14 @@ declare(strict_types=1); -namespace App\Http\Controllers\Dashboard; +namespace Keating\Http\Controllers\Dashboard; -use App\Http\Controllers\Controller; -use App\Http\Requests\FieldRequest; -use App\Models\Field; use Illuminate\Http\RedirectResponse; use Inertia\Response; +use Keating\Http\Requests\FieldRequest; +use Keating\Models\Field; -class FieldController extends Controller +class FieldController { public function index(): Response { diff --git a/app/Http/Controllers/Dashboard/GradeController.php b/app/Http/Controllers/Dashboard/GradeController.php index 1ddbc5c..5709684 100644 --- a/app/Http/Controllers/Dashboard/GradeController.php +++ b/app/Http/Controllers/Dashboard/GradeController.php @@ -2,21 +2,20 @@ declare(strict_types=1); -namespace App\Http\Controllers\Dashboard; - -use App\Http\Controllers\Controller; -use App\Http\Requests\UpdateGrade; -use App\Http\Requests\UpdateGradeColumn; -use App\Http\Resources\CourseSemesterResource; -use App\Models\CourseSemester; -use App\Models\GradeColumn; -use App\Models\Group; +namespace Keating\Http\Controllers\Dashboard; + use Illuminate\Database\Eloquent\Builder; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Inertia\Response; - -class GradeController extends Controller +use Keating\Http\Requests\UpdateGrade; +use Keating\Http\Requests\UpdateGradeColumn; +use Keating\Http\Resources\CourseSemesterResource; +use Keating\Models\CourseSemester; +use Keating\Models\GradeColumn; +use Keating\Models\Group; + +class GradeController { public function index(Request $request, CourseSemester $course, Group $group): Response { diff --git a/app/Http/Controllers/Dashboard/GroupController.php b/app/Http/Controllers/Dashboard/GroupController.php index 6b8c520..48a36d7 100644 --- a/app/Http/Controllers/Dashboard/GroupController.php +++ b/app/Http/Controllers/Dashboard/GroupController.php @@ -2,15 +2,14 @@ declare(strict_types=1); -namespace App\Http\Controllers\Dashboard; +namespace Keating\Http\Controllers\Dashboard; -use App\Http\Controllers\Controller; -use App\Http\Requests\GroupRequest; -use App\Models\CourseSemester; -use App\Models\Group; use Illuminate\Http\RedirectResponse; +use Keating\Http\Requests\GroupRequest; +use Keating\Models\CourseSemester; +use Keating\Models\Group; -class GroupController extends Controller +class GroupController { public function store(GroupRequest $request, CourseSemester $course): RedirectResponse { diff --git a/app/Http/Controllers/Dashboard/GroupStudentController.php b/app/Http/Controllers/Dashboard/GroupStudentController.php index f43e940..16b008b 100644 --- a/app/Http/Controllers/Dashboard/GroupStudentController.php +++ b/app/Http/Controllers/Dashboard/GroupStudentController.php @@ -2,19 +2,18 @@ declare(strict_types=1); -namespace App\Http\Controllers\Dashboard; +namespace Keating\Http\Controllers\Dashboard; -use App\Http\Controllers\Controller; -use App\Http\Resources\CourseSemesterResource; -use App\Models\CourseSemester; -use App\Models\Group; -use App\Models\Student; use Illuminate\Database\Eloquent\Builder; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Inertia\Response; +use Keating\Http\Resources\CourseSemesterResource; +use Keating\Models\CourseSemester; +use Keating\Models\Group; +use Keating\Models\Student; -class GroupStudentController extends Controller +class GroupStudentController { public function index(Request $request, CourseSemester $course, Group $group): Response { diff --git a/app/Http/Controllers/Dashboard/LogoutController.php b/app/Http/Controllers/Dashboard/LogoutController.php index 06c765f..0ba550c 100644 --- a/app/Http/Controllers/Dashboard/LogoutController.php +++ b/app/Http/Controllers/Dashboard/LogoutController.php @@ -2,21 +2,19 @@ declare(strict_types=1); -namespace App\Http\Controllers\Dashboard; +namespace Keating\Http\Controllers\Dashboard; -use App\Http\Controllers\Controller; +use Illuminate\Auth\AuthManager; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; -use Illuminate\Support\Facades\Auth; -class LogoutController extends Controller +class LogoutController { - public function __invoke(Request $request): RedirectResponse + public function __invoke(Request $request, AuthManager $auth): RedirectResponse { - Auth::logout(); + $auth->logout(); $request->session()->invalidate(); - $request->session()->regenerateToken(); return redirect()->route("main"); diff --git a/app/Http/Controllers/Dashboard/NewsManagementController.php b/app/Http/Controllers/Dashboard/NewsManagementController.php index c3afc4f..96858d7 100644 --- a/app/Http/Controllers/Dashboard/NewsManagementController.php +++ b/app/Http/Controllers/Dashboard/NewsManagementController.php @@ -2,17 +2,16 @@ declare(strict_types=1); -namespace App\Http\Controllers\Dashboard; +namespace Keating\Http\Controllers\Dashboard; -use App\Http\Controllers\Controller; -use App\Http\Requests\NewsRequest; -use App\Models\News; use Illuminate\Database\Eloquent\Builder; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Inertia\Response; +use Keating\Http\Requests\NewsRequest; +use Keating\Models\News; -class NewsManagementController extends Controller +class NewsManagementController { public function index(Request $request): Response { diff --git a/app/Http/Controllers/Dashboard/PasswordUpdateController.php b/app/Http/Controllers/Dashboard/PasswordUpdateController.php index eac69ca..caceb3f 100644 --- a/app/Http/Controllers/Dashboard/PasswordUpdateController.php +++ b/app/Http/Controllers/Dashboard/PasswordUpdateController.php @@ -2,23 +2,22 @@ declare(strict_types=1); -namespace App\Http\Controllers\Dashboard; +namespace Keating\Http\Controllers\Dashboard; -use App\Http\Controllers\Controller; +use Illuminate\Contracts\Hashing\Hasher; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; -use Illuminate\Support\Facades\Hash; use Illuminate\Validation\Rules\Password; use Inertia\Response; -class PasswordUpdateController extends Controller +class PasswordUpdateController { public function edit(): Response { return inertia("Dashboard/PasswordUpdate"); } - public function update(Request $request): RedirectResponse + public function update(Request $request, Hasher $hasher): RedirectResponse { $validated = $request->validate([ "current_password" => ["required", "current_password"], @@ -26,7 +25,7 @@ public function update(Request $request): RedirectResponse ]); $request->user()->update([ - "password" => Hash::make($validated["password"]), + "password" => $hasher->make($validated["password"]), ]); return redirect()->back() diff --git a/app/Http/Controllers/Dashboard/SectionController.php b/app/Http/Controllers/Dashboard/SectionController.php index 0ce7e82..5a9885b 100644 --- a/app/Http/Controllers/Dashboard/SectionController.php +++ b/app/Http/Controllers/Dashboard/SectionController.php @@ -2,18 +2,17 @@ declare(strict_types=1); -namespace App\Http\Controllers\Dashboard; +namespace Keating\Http\Controllers\Dashboard; -use App\Enums\SectionType; -use App\Http\Controllers\Controller; -use App\Http\Requests\SectionRequest; -use App\Models\Section; -use App\Models\SectionSettings; use Illuminate\Http\RedirectResponse; use Inertia\Response; +use Keating\Enums\SectionType; +use Keating\Http\Requests\SectionRequest; +use Keating\Models\Section; +use Keating\Models\SectionSettings; use Spatie\LaravelOptions\Options; -class SectionController extends Controller +class SectionController { public function show(): Response { diff --git a/app/Http/Controllers/Dashboard/SectionSettingsController.php b/app/Http/Controllers/Dashboard/SectionSettingsController.php index 3adbedf..1967981 100644 --- a/app/Http/Controllers/Dashboard/SectionSettingsController.php +++ b/app/Http/Controllers/Dashboard/SectionSettingsController.php @@ -2,14 +2,13 @@ declare(strict_types=1); -namespace App\Http\Controllers\Dashboard; +namespace Keating\Http\Controllers\Dashboard; -use App\Http\Controllers\Controller; -use App\Models\SectionSettings; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; +use Keating\Models\SectionSettings; -class SectionSettingsController extends Controller +class SectionSettingsController { public function __invoke(Request $request): RedirectResponse { diff --git a/app/Http/Controllers/Dashboard/SemesterController.php b/app/Http/Controllers/Dashboard/SemesterController.php index 38cb5e7..aaab465 100644 --- a/app/Http/Controllers/Dashboard/SemesterController.php +++ b/app/Http/Controllers/Dashboard/SemesterController.php @@ -2,17 +2,16 @@ declare(strict_types=1); -namespace App\Http\Controllers\Dashboard; +namespace Keating\Http\Controllers\Dashboard; -use App\Actions\ActivateSemesterAction; -use App\Http\Controllers\Controller; -use App\Http\Requests\SemesterRequest; -use App\Models\Semester; use Exception; use Illuminate\Http\RedirectResponse; use Inertia\Response; +use Keating\Actions\ActivateSemesterAction; +use Keating\Http\Requests\SemesterRequest; +use Keating\Models\Semester; -class SemesterController extends Controller +class SemesterController { public function index(): Response { diff --git a/app/Http/Controllers/Dashboard/SettingController.php b/app/Http/Controllers/Dashboard/SettingController.php index 1fb1db0..8d894f1 100644 --- a/app/Http/Controllers/Dashboard/SettingController.php +++ b/app/Http/Controllers/Dashboard/SettingController.php @@ -2,16 +2,15 @@ declare(strict_types=1); -namespace App\Http\Controllers\Dashboard; +namespace Keating\Http\Controllers\Dashboard; -use App\Http\Controllers\Controller; -use App\Http\Requests\SettingRequest; -use App\Models\Setting; +use Illuminate\Filesystem\FilesystemManager; use Illuminate\Http\RedirectResponse; -use Illuminate\Support\Facades\Storage; use Inertia\Response; +use Keating\Http\Requests\SettingRequest; +use Keating\Models\Setting; -class SettingController extends Controller +class SettingController { public function edit(): Response { @@ -20,20 +19,20 @@ public function edit(): Response ]); } - public function update(SettingRequest $request): RedirectResponse + public function update(SettingRequest $request, FilesystemManager $filesystem): RedirectResponse { $settings = Setting::query()->firstOrFail(); $settings->fill($request->getData()); if ($request->file("logo")) { if ($settings->logo) { - Storage::disk("public")->delete($settings->logo); + $filesystem->disk("public")->delete($settings->logo); } $file = $request->file("logo"); $fileName = $file->getClientOriginalName(); $path = "/logo"; - $fullPath = Storage::disk("public")->putFileAs($path, $file, $fileName); + $fullPath = $filesystem->disk("public")->putFileAs($path, $file, $fileName); $settings->logo = $fullPath; } @@ -44,12 +43,13 @@ public function update(SettingRequest $request): RedirectResponse ->with("success", "Zaktualizowano ustawienia"); } - public function removeLogo(): RedirectResponse + public function removeLogo(FilesystemManager $filesystem): RedirectResponse { $settings = Setting::query()->firstOrFail(); if ($settings->logo) { - $res = Storage::disk("public")->delete($settings->logo); + $filesystem->disk("public")->delete($settings->logo); + $settings->logo = null; $settings->save(); diff --git a/app/Http/Controllers/Dashboard/StudentController.php b/app/Http/Controllers/Dashboard/StudentController.php index 82b5f2a..99ec6aa 100644 --- a/app/Http/Controllers/Dashboard/StudentController.php +++ b/app/Http/Controllers/Dashboard/StudentController.php @@ -2,19 +2,18 @@ declare(strict_types=1); -namespace App\Http\Controllers\Dashboard; +namespace Keating\Http\Controllers\Dashboard; -use App\Actions\WuStudentsImport; -use App\Http\Controllers\Controller; -use App\Http\Requests\StoreStudentRequest; -use App\Http\Requests\UpdateStudentRequest; -use App\Models\Student; use Illuminate\Database\Eloquent\Builder; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Inertia\Response; +use Keating\Actions\WuStudentsImport; +use Keating\Http\Requests\StoreStudentRequest; +use Keating\Http\Requests\UpdateStudentRequest; +use Keating\Models\Student; -class StudentController extends Controller +class StudentController { public function index(Request $request): Response { diff --git a/app/Http/Controllers/Public/CourseController.php b/app/Http/Controllers/Public/CourseController.php index 975403d..8e01084 100644 --- a/app/Http/Controllers/Public/CourseController.php +++ b/app/Http/Controllers/Public/CourseController.php @@ -2,15 +2,14 @@ declare(strict_types=1); -namespace App\Http\Controllers\Public; +namespace Keating\Http\Controllers\Public; -use App\Http\Controllers\Controller; -use App\Http\Resources\CoursePublicResource as CourseResource; -use App\Models\Course; -use App\Models\Semester; use Inertia\Response; +use Keating\Http\Resources\CoursePublicResource as CourseResource; +use Keating\Models\Course; +use Keating\Models\Semester; -class CourseController extends Controller +class CourseController { public function index(): Response { diff --git a/app/Http/Controllers/Public/GradeController.php b/app/Http/Controllers/Public/GradeController.php index f021e9e..921a63b 100644 --- a/app/Http/Controllers/Public/GradeController.php +++ b/app/Http/Controllers/Public/GradeController.php @@ -2,19 +2,18 @@ declare(strict_types=1); -namespace App\Http\Controllers\Public; +namespace Keating\Http\Controllers\Public; -use App\DTOs\StudentData; -use App\Http\Controllers\Controller; -use App\Models\CourseSemester; -use App\Models\Group; -use App\Models\Semester; -use App\Models\Student; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Http\Request; use Inertia\Response; +use Keating\DTOs\StudentData; +use Keating\Models\CourseSemester; +use Keating\Models\Group; +use Keating\Models\Semester; +use Keating\Models\Student; -class GradeController extends Controller +class GradeController { public function __invoke(Request $request, ?Semester $semester = null, ?CourseSemester $course = null, ?Group $group = null, ?string $index = null): Response { diff --git a/app/Http/Controllers/Public/HomeController.php b/app/Http/Controllers/Public/HomeController.php index 6cc8964..c4c0f75 100644 --- a/app/Http/Controllers/Public/HomeController.php +++ b/app/Http/Controllers/Public/HomeController.php @@ -2,15 +2,14 @@ declare(strict_types=1); -namespace App\Http\Controllers\Public; +namespace Keating\Http\Controllers\Public; -use App\Http\Controllers\Controller; -use App\Models\Section; -use App\Models\SectionSettings; -use App\Models\Setting; use Inertia\Response; +use Keating\Models\Section; +use Keating\Models\SectionSettings; +use Keating\Models\Setting; -class HomeController extends Controller +class HomeController { public function __invoke(): Response { diff --git a/app/Http/Controllers/Public/LoginController.php b/app/Http/Controllers/Public/LoginController.php index 5eb9c2d..eaa53fa 100644 --- a/app/Http/Controllers/Public/LoginController.php +++ b/app/Http/Controllers/Public/LoginController.php @@ -2,15 +2,14 @@ declare(strict_types=1); -namespace App\Http\Controllers\Public; +namespace Keating\Http\Controllers\Public; -use App\Http\Controllers\Controller; +use Illuminate\Auth\AuthManager; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; -use Illuminate\Support\Facades\Auth; use Inertia\Response; -class LoginController extends Controller +class LoginController { public function create(): Response { @@ -19,11 +18,11 @@ public function create(): Response ]); } - public function store(Request $request): RedirectResponse + public function store(Request $request, AuthManager $auth): RedirectResponse { $credentials = $request->only("email", "password"); - if (Auth::attempt($credentials)) { + if ($auth->attempt($credentials)) { $request->session()->regenerate(); return redirect()->route("dashboard"); diff --git a/app/Http/Controllers/Public/NewsController.php b/app/Http/Controllers/Public/NewsController.php index f900099..cc474fd 100644 --- a/app/Http/Controllers/Public/NewsController.php +++ b/app/Http/Controllers/Public/NewsController.php @@ -2,13 +2,12 @@ declare(strict_types=1); -namespace App\Http\Controllers\Public; +namespace Keating\Http\Controllers\Public; -use App\Http\Controllers\Controller; -use App\Models\News; use Inertia\Response; +use Keating\Models\News; -class NewsController extends Controller +class NewsController { public function index(): Response { diff --git a/app/Http/Middleware/HandleInertiaRequests.php b/app/Http/Middleware/HandleInertiaRequests.php index 492c246..a3640bf 100644 --- a/app/Http/Middleware/HandleInertiaRequests.php +++ b/app/Http/Middleware/HandleInertiaRequests.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Http\Middleware; +namespace Keating\Http\Middleware; use Closure; use Illuminate\Http\Request; diff --git a/app/Http/Requests/ContactInfoRequest.php b/app/Http/Requests/ContactInfoRequest.php index 3313316..d70963f 100644 --- a/app/Http/Requests/ContactInfoRequest.php +++ b/app/Http/Requests/ContactInfoRequest.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace App\Http\Requests; +namespace Keating\Http\Requests; -use App\Enums\Icons; use Illuminate\Foundation\Http\FormRequest; use Illuminate\Validation\Rules\Enum; +use Keating\Enums\Icons; class ContactInfoRequest extends FormRequest { diff --git a/app/Http/Requests/CourseRequest.php b/app/Http/Requests/CourseRequest.php index 0695ca1..736c03c 100644 --- a/app/Http/Requests/CourseRequest.php +++ b/app/Http/Requests/CourseRequest.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace App\Http\Requests; +namespace Keating\Http\Requests; -use App\Enums\ClassType; -use App\Enums\SemesterName; use Illuminate\Foundation\Http\FormRequest; use Illuminate\Support\Str; use Illuminate\Validation\Rule; use Illuminate\Validation\Rules\Enum; +use Keating\Enums\ClassType; +use Keating\Enums\SemesterName; class CourseRequest extends FormRequest { diff --git a/app/Http/Requests/CourseSemesterRequest.php b/app/Http/Requests/CourseSemesterRequest.php index 31c1335..337763a 100644 --- a/app/Http/Requests/CourseSemesterRequest.php +++ b/app/Http/Requests/CourseSemesterRequest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Http\Requests; +namespace Keating\Http\Requests; use Illuminate\Foundation\Http\FormRequest; diff --git a/app/Http/Requests/FaqRequest.php b/app/Http/Requests/FaqRequest.php index ce2a741..51b35a4 100644 --- a/app/Http/Requests/FaqRequest.php +++ b/app/Http/Requests/FaqRequest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Http\Requests; +namespace Keating\Http\Requests; use Illuminate\Foundation\Http\FormRequest; diff --git a/app/Http/Requests/FieldRequest.php b/app/Http/Requests/FieldRequest.php index e218eca..e238c0e 100644 --- a/app/Http/Requests/FieldRequest.php +++ b/app/Http/Requests/FieldRequest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Http\Requests; +namespace Keating\Http\Requests; use Illuminate\Foundation\Http\FormRequest; diff --git a/app/Http/Requests/GroupRequest.php b/app/Http/Requests/GroupRequest.php index 00df413..3d6bf4e 100644 --- a/app/Http/Requests/GroupRequest.php +++ b/app/Http/Requests/GroupRequest.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace App\Http\Requests; +namespace Keating\Http\Requests; -use App\Enums\StudyForm; use Illuminate\Foundation\Http\FormRequest; use Illuminate\Validation\Rules\Enum; +use Keating\Enums\StudyForm; class GroupRequest extends FormRequest { diff --git a/app/Http/Requests/NewsRequest.php b/app/Http/Requests/NewsRequest.php index 3fb157f..79f8dc5 100644 --- a/app/Http/Requests/NewsRequest.php +++ b/app/Http/Requests/NewsRequest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Http\Requests; +namespace Keating\Http\Requests; use Carbon\Carbon; use Illuminate\Foundation\Http\FormRequest; diff --git a/app/Http/Requests/SectionRequest.php b/app/Http/Requests/SectionRequest.php index 254ae58..d627052 100644 --- a/app/Http/Requests/SectionRequest.php +++ b/app/Http/Requests/SectionRequest.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace App\Http\Requests; +namespace Keating\Http\Requests; -use App\Enums\SectionType; use Illuminate\Foundation\Http\FormRequest; use Illuminate\Validation\Rules\Enum; +use Keating\Enums\SectionType; class SectionRequest extends FormRequest { diff --git a/app/Http/Requests/SemesterRequest.php b/app/Http/Requests/SemesterRequest.php index 9848c9f..04987cf 100644 --- a/app/Http/Requests/SemesterRequest.php +++ b/app/Http/Requests/SemesterRequest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Http\Requests; +namespace Keating\Http\Requests; use Illuminate\Foundation\Http\FormRequest; diff --git a/app/Http/Requests/SettingRequest.php b/app/Http/Requests/SettingRequest.php index ae103e1..0eabf75 100644 --- a/app/Http/Requests/SettingRequest.php +++ b/app/Http/Requests/SettingRequest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Http\Requests; +namespace Keating\Http\Requests; use Illuminate\Foundation\Http\FormRequest; diff --git a/app/Http/Requests/StoreStudentRequest.php b/app/Http/Requests/StoreStudentRequest.php index e88d727..8621c8d 100644 --- a/app/Http/Requests/StoreStudentRequest.php +++ b/app/Http/Requests/StoreStudentRequest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Http\Requests; +namespace Keating\Http\Requests; use Illuminate\Foundation\Http\FormRequest; diff --git a/app/Http/Requests/UpdateGrade.php b/app/Http/Requests/UpdateGrade.php index ab451dc..72a02e9 100644 --- a/app/Http/Requests/UpdateGrade.php +++ b/app/Http/Requests/UpdateGrade.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Http\Requests; +namespace Keating\Http\Requests; use Illuminate\Foundation\Http\FormRequest; diff --git a/app/Http/Requests/UpdateGradeColumn.php b/app/Http/Requests/UpdateGradeColumn.php index bb962f4..8cba059 100644 --- a/app/Http/Requests/UpdateGradeColumn.php +++ b/app/Http/Requests/UpdateGradeColumn.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Http\Requests; +namespace Keating\Http\Requests; use Illuminate\Foundation\Http\FormRequest; diff --git a/app/Http/Requests/UpdateStudentRequest.php b/app/Http/Requests/UpdateStudentRequest.php index 8f7d41e..fadc05c 100644 --- a/app/Http/Requests/UpdateStudentRequest.php +++ b/app/Http/Requests/UpdateStudentRequest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Http\Requests; +namespace Keating\Http\Requests; use Illuminate\Foundation\Http\FormRequest; diff --git a/app/Http/Resources/CoursePublicResource.php b/app/Http/Resources/CoursePublicResource.php index 6bfa40a..6f37f6c 100644 --- a/app/Http/Resources/CoursePublicResource.php +++ b/app/Http/Resources/CoursePublicResource.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace App\Http\Resources; +namespace Keating\Http\Resources; -use App\Enums\ClassType; -use App\Enums\SemesterName; -use App\Models\Course; use Illuminate\Http\Request; use Illuminate\Http\Resources\Json\JsonResource; use Illuminate\Support\Collection; +use Keating\Enums\ClassType; +use Keating\Enums\SemesterName; +use Keating\Models\Course; class CoursePublicResource extends JsonResource { diff --git a/app/Http/Resources/CourseResource.php b/app/Http/Resources/CourseResource.php index 5b8be91..3c6bdbc 100644 --- a/app/Http/Resources/CourseResource.php +++ b/app/Http/Resources/CourseResource.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace App\Http\Resources; +namespace Keating\Http\Resources; -use App\Enums\ClassType; -use App\Models\Course; use Illuminate\Http\Request; use Illuminate\Http\Resources\Json\JsonResource; +use Keating\Enums\ClassType; +use Keating\Models\Course; class CourseResource extends JsonResource { diff --git a/app/Http/Resources/CourseSemesterResource.php b/app/Http/Resources/CourseSemesterResource.php index 1050f59..302f74d 100644 --- a/app/Http/Resources/CourseSemesterResource.php +++ b/app/Http/Resources/CourseSemesterResource.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace App\Http\Resources; +namespace Keating\Http\Resources; -use App\Models\CourseSemester; use Illuminate\Http\Request; use Illuminate\Http\Resources\Json\JsonResource; +use Keating\Models\CourseSemester; class CourseSemesterResource extends JsonResource { diff --git a/app/Http/Resources/FieldResource.php b/app/Http/Resources/FieldResource.php index 9f4e3c5..45a9913 100644 --- a/app/Http/Resources/FieldResource.php +++ b/app/Http/Resources/FieldResource.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace App\Http\Resources; +namespace Keating\Http\Resources; -use App\Models\Field; use Illuminate\Http\Request; use Illuminate\Http\Resources\Json\JsonResource; +use Keating\Models\Field; class FieldResource extends JsonResource { diff --git a/app/Http/Resources/GroupResource.php b/app/Http/Resources/GroupResource.php index b66cc13..2354b5d 100644 --- a/app/Http/Resources/GroupResource.php +++ b/app/Http/Resources/GroupResource.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace App\Http\Resources; +namespace Keating\Http\Resources; -use App\Enums\StudyForm; -use App\Models\Group; use Illuminate\Http\Request; use Illuminate\Http\Resources\Json\JsonResource; +use Keating\Enums\StudyForm; +use Keating\Models\Group; class GroupResource extends JsonResource { diff --git a/app/Models/ContactInfo.php b/app/Models/ContactInfo.php index f1bb1f0..0796508 100644 --- a/app/Models/ContactInfo.php +++ b/app/Models/ContactInfo.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Models; +namespace Keating\Models; use Carbon\Carbon; use Illuminate\Database\Eloquent\Concerns\HasUlids; diff --git a/app/Models/Course.php b/app/Models/Course.php index 93a38b9..b3c8291 100644 --- a/app/Models/Course.php +++ b/app/Models/Course.php @@ -2,9 +2,8 @@ declare(strict_types=1); -namespace App\Models; +namespace Keating\Models; -use App\Observers\CourseObserver; use Carbon\Carbon; use Illuminate\Database\Eloquent\Attributes\ObservedBy; use Illuminate\Database\Eloquent\Casts\Attribute; @@ -12,6 +11,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Keating\Observers\CourseObserver; use Stevebauman\Purify\Facades\Purify; /** diff --git a/app/Models/CourseSemester.php b/app/Models/CourseSemester.php index c2a3e0f..7853a15 100644 --- a/app/Models/CourseSemester.php +++ b/app/Models/CourseSemester.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Models; +namespace Keating\Models; use Carbon\Carbon; use Illuminate\Database\Eloquent\Concerns\HasUlids; diff --git a/app/Models/Faq.php b/app/Models/Faq.php index d59fdbb..3e459ae 100644 --- a/app/Models/Faq.php +++ b/app/Models/Faq.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Models; +namespace Keating\Models; use Carbon\Carbon; use Illuminate\Database\Eloquent\Casts\Attribute; diff --git a/app/Models/Field.php b/app/Models/Field.php index f326f7b..7cf2e68 100644 --- a/app/Models/Field.php +++ b/app/Models/Field.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Models; +namespace Keating\Models; use Carbon\Carbon; use Illuminate\Database\Eloquent\Concerns\HasUlids; diff --git a/app/Models/Grade.php b/app/Models/Grade.php index 9c331a3..8f2da74 100644 --- a/app/Models/Grade.php +++ b/app/Models/Grade.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace App\Models; +namespace Keating\Models; -use App\Observers\GradeObserver; use Carbon\Carbon; use Illuminate\Database\Eloquent\Concerns\HasUlids; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Keating\Observers\GradeObserver; /** * @property string $id diff --git a/app/Models/GradeColumn.php b/app/Models/GradeColumn.php index e087aa7..f7e263a 100644 --- a/app/Models/GradeColumn.php +++ b/app/Models/GradeColumn.php @@ -2,9 +2,8 @@ declare(strict_types=1); -namespace App\Models; +namespace Keating\Models; -use App\Observers\GradeColumnObserver; use Carbon\Carbon; use Illuminate\Database\Eloquent\Attributes\ObservedBy; use Illuminate\Database\Eloquent\Concerns\HasUlids; @@ -13,6 +12,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Support\Collection; +use Keating\Observers\GradeColumnObserver; /** * @property string $id diff --git a/app/Models/Group.php b/app/Models/Group.php index fdde721..5d7e747 100644 --- a/app/Models/Group.php +++ b/app/Models/Group.php @@ -2,9 +2,8 @@ declare(strict_types=1); -namespace App\Models; +namespace Keating\Models; -use App\Enums\StudyForm; use Carbon\Carbon; use Illuminate\Database\Eloquent\Concerns\HasUlids; use Illuminate\Database\Eloquent\Factories\HasFactory; @@ -12,6 +11,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\HasMany; +use Keating\Enums\StudyForm; /** * @property string $id diff --git a/app/Models/News.php b/app/Models/News.php index db3ddee..f8d023d 100644 --- a/app/Models/News.php +++ b/app/Models/News.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace App\Models; +namespace Keating\Models; -use App\Observers\NewsObserver; use Carbon\Carbon; use Illuminate\Database\Eloquent\Attributes\ObservedBy; use Illuminate\Database\Eloquent\Concerns\HasUlids; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Keating\Observers\NewsObserver; /** * @property string $id @@ -33,7 +33,7 @@ class News extends Model protected $casts = [ "published_at" => "datetime:Y-m-d H:i", ]; - protected $appends = [ + protected $Keatingends = [ "published_at_formatted", ]; diff --git a/app/Models/Section.php b/app/Models/Section.php index 1ddb79c..6e7bfc2 100644 --- a/app/Models/Section.php +++ b/app/Models/Section.php @@ -2,15 +2,15 @@ declare(strict_types=1); -namespace App\Models; +namespace Keating\Models; -use App\Enums\SectionType; use Carbon\Carbon; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Concerns\HasUlids; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Keating\Enums\SectionType; use Stevebauman\Purify\Facades\Purify; /** diff --git a/app/Models/SectionSettings.php b/app/Models/SectionSettings.php index 362975c..b6eca2d 100644 --- a/app/Models/SectionSettings.php +++ b/app/Models/SectionSettings.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Models; +namespace Keating\Models; use Carbon\Carbon; use Illuminate\Database\Eloquent\Concerns\HasUlids; diff --git a/app/Models/Semester.php b/app/Models/Semester.php index 2ea5cc9..e1fce70 100644 --- a/app/Models/Semester.php +++ b/app/Models/Semester.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Models; +namespace Keating\Models; use Carbon\Carbon; use Illuminate\Database\Eloquent\Builder; diff --git a/app/Models/Setting.php b/app/Models/Setting.php index bb4dc61..a925bea 100644 --- a/app/Models/Setting.php +++ b/app/Models/Setting.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Models; +namespace Keating\Models; use Carbon\Carbon; use Illuminate\Database\Eloquent\Concerns\HasUlids; diff --git a/app/Models/Student.php b/app/Models/Student.php index 03e3eee..a9a5a69 100644 --- a/app/Models/Student.php +++ b/app/Models/Student.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Models; +namespace Keating\Models; use Carbon\Carbon; use Illuminate\Database\Eloquent\Concerns\HasUlids; diff --git a/app/Models/User.php b/app/Models/User.php index b86a3d2..2c21260 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Models; +namespace Keating\Models; use Carbon\Carbon; use Illuminate\Database\Eloquent\Concerns\HasUlids; diff --git a/app/Observers/CourseObserver.php b/app/Observers/CourseObserver.php index 3cfb980..ab6c6cc 100644 --- a/app/Observers/CourseObserver.php +++ b/app/Observers/CourseObserver.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace App\Observers; +namespace Keating\Observers; -use App\Models\Course; -use App\Traits\Sluggable; +use Keating\Models\Course; +use Keating\Traits\Sluggable; class CourseObserver { diff --git a/app/Observers/GradeColumnObserver.php b/app/Observers/GradeColumnObserver.php index 9e8d99e..87bad3a 100644 --- a/app/Observers/GradeColumnObserver.php +++ b/app/Observers/GradeColumnObserver.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace App\Observers; +namespace Keating\Observers; -use App\Models\GradeColumn; +use Keating\Models\GradeColumn; class GradeColumnObserver { diff --git a/app/Observers/GradeObserver.php b/app/Observers/GradeObserver.php index 9094d7a..5642ce5 100644 --- a/app/Observers/GradeObserver.php +++ b/app/Observers/GradeObserver.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace App\Observers; +namespace Keating\Observers; -use App\Models\Grade; +use Keating\Models\Grade; class GradeObserver { diff --git a/app/Observers/NewsObserver.php b/app/Observers/NewsObserver.php index e13e42c..aaa8e6a 100644 --- a/app/Observers/NewsObserver.php +++ b/app/Observers/NewsObserver.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace App\Observers; +namespace Keating\Observers; -use App\Models\News; -use App\Traits\Sluggable; +use Keating\Models\News; +use Keating\Traits\Sluggable; class NewsObserver { diff --git a/app/Providers/BuilderServiceProvider.php b/app/Providers/BuilderServiceProvider.php index 7a4ab3d..8c1eb27 100644 --- a/app/Providers/BuilderServiceProvider.php +++ b/app/Providers/BuilderServiceProvider.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Providers; +namespace Keating\Providers; use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\ServiceProvider; diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 874b7c3..93eaaaa 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Providers; +namespace Keating\Providers; use Illuminate\Auth\Events\Registered; use Illuminate\Auth\Listeners\SendEmailVerificationNotification; diff --git a/app/Providers/ViewServiceProvider.php b/app/Providers/ViewServiceProvider.php index 559fc0f..321e223 100644 --- a/app/Providers/ViewServiceProvider.php +++ b/app/Providers/ViewServiceProvider.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace App\Providers; +namespace Keating\Providers; -use App\Models\Setting; use Illuminate\Cache\CacheManager; use Illuminate\Database\QueryException; use Illuminate\Support\ServiceProvider; use Illuminate\View\Factory; +use Keating\Models\Setting; class ViewServiceProvider extends ServiceProvider { diff --git a/app/Traits/Sluggable.php b/app/Traits/Sluggable.php index 6834121..455fd20 100644 --- a/app/Traits/Sluggable.php +++ b/app/Traits/Sluggable.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Traits; +namespace Keating\Traits; use Closure; use Illuminate\Database\Eloquent\Model; diff --git a/bootstrap/app.php b/bootstrap/app.php index f3d720c..c4a9d7b 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -2,12 +2,12 @@ declare(strict_types=1); -use App\Http\Middleware\HandleInertiaRequests; use Illuminate\Foundation\Application; use Illuminate\Foundation\Configuration\Exceptions; use Illuminate\Foundation\Configuration\Middleware; use Illuminate\Http\Request; use Inertia\Inertia; +use Keating\Http\Middleware\HandleInertiaRequests; use Symfony\Component\HttpFoundation\Response; return Application::configure(basePath: dirname(__DIR__)) diff --git a/bootstrap/providers.php b/bootstrap/providers.php index 16e7c3b..957fa99 100644 --- a/bootstrap/providers.php +++ b/bootstrap/providers.php @@ -2,8 +2,8 @@ declare(strict_types=1); -use App\Providers\BuilderServiceProvider; -use App\Providers\ViewServiceProvider; +use Keating\Providers\BuilderServiceProvider; +use Keating\Providers\ViewServiceProvider; return [ BuilderServiceProvider::class, diff --git a/composer.json b/composer.json index 0688451..7d8bde4 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ }, "autoload": { "psr-4": { - "App\\": "app/", + "Keating\\": "app/", "Database\\Factories\\": "database/factories/", "Database\\Seeders\\": "database/seeders/" } diff --git a/config/auth.php b/config/auth.php index 5a250a3..d82759b 100644 --- a/config/auth.php +++ b/config/auth.php @@ -1,7 +1,7 @@ [ diff --git a/database/factories/ContactInfoFactory.php b/database/factories/ContactInfoFactory.php index f981096..6b8cf6a 100644 --- a/database/factories/ContactInfoFactory.php +++ b/database/factories/ContactInfoFactory.php @@ -4,9 +4,9 @@ namespace Database\Factories; -use App\Enums\Icons; -use App\Models\ContactInfo; use Illuminate\Database\Eloquent\Factories\Factory; +use Keating\Enums\Icons; +use Keating\Models\ContactInfo; /** * @extends Factory diff --git a/database/factories/CourseFactory.php b/database/factories/CourseFactory.php index 874dc19..6795dbf 100644 --- a/database/factories/CourseFactory.php +++ b/database/factories/CourseFactory.php @@ -4,10 +4,10 @@ namespace Database\Factories; -use App\Enums\ClassType; -use App\Enums\SemesterName; -use App\Models\Field; use Illuminate\Database\Eloquent\Factories\Factory; +use Keating\Enums\ClassType; +use Keating\Enums\SemesterName; +use Keating\Models\Field; class CourseFactory extends Factory { diff --git a/database/factories/CourseSemesterFactory.php b/database/factories/CourseSemesterFactory.php index 4878eeb..12cc785 100644 --- a/database/factories/CourseSemesterFactory.php +++ b/database/factories/CourseSemesterFactory.php @@ -4,9 +4,9 @@ namespace Database\Factories; -use App\Models\Course; -use App\Models\Semester; use Illuminate\Database\Eloquent\Factories\Factory; +use Keating\Models\Course; +use Keating\Models\Semester; class CourseSemesterFactory extends Factory { diff --git a/database/factories/FaqFactory.php b/database/factories/FaqFactory.php index 0baaf39..656f778 100644 --- a/database/factories/FaqFactory.php +++ b/database/factories/FaqFactory.php @@ -4,8 +4,8 @@ namespace Database\Factories; -use App\Models\Faq; use Illuminate\Database\Eloquent\Factories\Factory; +use Keating\Models\Faq; /** * @extends Factory diff --git a/database/factories/GradeColumnFactory.php b/database/factories/GradeColumnFactory.php index 65f7d42..a37d4a5 100644 --- a/database/factories/GradeColumnFactory.php +++ b/database/factories/GradeColumnFactory.php @@ -4,8 +4,8 @@ namespace Database\Factories; -use App\Models\Group; use Illuminate\Database\Eloquent\Factories\Factory; +use Keating\Models\Group; class GradeColumnFactory extends Factory { diff --git a/database/factories/GradeFactory.php b/database/factories/GradeFactory.php index 6c5d477..05c0192 100644 --- a/database/factories/GradeFactory.php +++ b/database/factories/GradeFactory.php @@ -4,9 +4,9 @@ namespace Database\Factories; -use App\Models\GradeColumn; -use App\Models\Student; use Illuminate\Database\Eloquent\Factories\Factory; +use Keating\Models\GradeColumn; +use Keating\Models\Student; class GradeFactory extends Factory { diff --git a/database/factories/GroupFactory.php b/database/factories/GroupFactory.php index c868a24..e6204c1 100644 --- a/database/factories/GroupFactory.php +++ b/database/factories/GroupFactory.php @@ -4,9 +4,9 @@ namespace Database\Factories; -use App\Enums\StudyForm; -use App\Models\CourseSemester; use Illuminate\Database\Eloquent\Factories\Factory; +use Keating\Enums\StudyForm; +use Keating\Models\CourseSemester; class GroupFactory extends Factory { diff --git a/database/factories/SectionFactory.php b/database/factories/SectionFactory.php index c66e6b1..79b09ac 100644 --- a/database/factories/SectionFactory.php +++ b/database/factories/SectionFactory.php @@ -4,8 +4,8 @@ namespace Database\Factories; -use App\Enums\SectionType; use Illuminate\Database\Eloquent\Factories\Factory; +use Keating\Enums\SectionType; class SectionFactory extends Factory { diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index ce2707f..6fb7b09 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -4,9 +4,9 @@ namespace Database\Factories; -use App\Models\User; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Facades\Hash; +use Keating\Models\User; /** * @extends Factory diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 4552c2e..4b5de92 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -4,16 +4,16 @@ namespace Database\Seeders; -use App\Models\CourseSemester; -use App\Models\Grade; -use App\Models\GradeColumn; -use App\Models\Group; -use App\Models\Section; -use App\Models\SectionSettings; -use App\Models\Setting; -use App\Models\Student; -use App\Models\User; use Illuminate\Database\Seeder; +use Keating\Models\CourseSemester; +use Keating\Models\Grade; +use Keating\Models\GradeColumn; +use Keating\Models\Group; +use Keating\Models\Section; +use Keating\Models\SectionSettings; +use Keating\Models\Setting; +use Keating\Models\Student; +use Keating\Models\User; class DatabaseSeeder extends Seeder { diff --git a/database/seeders/DemoSeeder.php b/database/seeders/DemoSeeder.php index 201a9cf..d7a6b55 100644 --- a/database/seeders/DemoSeeder.php +++ b/database/seeders/DemoSeeder.php @@ -4,8 +4,8 @@ namespace Database\Seeders; -use App\Models\News; use Illuminate\Database\Seeder; +use Keating\Models\News; class DemoSeeder extends Seeder { diff --git a/routes/web.php b/routes/web.php index da440da..e167247 100644 --- a/routes/web.php +++ b/routes/web.php @@ -2,29 +2,29 @@ declare(strict_types=1); -use App\Http\Controllers\Dashboard\ContactInfoController; -use App\Http\Controllers\Dashboard\CourseController; -use App\Http\Controllers\Dashboard\CourseSemesterController; -use App\Http\Controllers\Dashboard\DashboardController; -use App\Http\Controllers\Dashboard\FaqController; -use App\Http\Controllers\Dashboard\FieldController; -use App\Http\Controllers\Dashboard\GradeController; -use App\Http\Controllers\Dashboard\GroupController; -use App\Http\Controllers\Dashboard\GroupStudentController; -use App\Http\Controllers\Dashboard\LogoutController; -use App\Http\Controllers\Dashboard\NewsManagementController; -use App\Http\Controllers\Dashboard\PasswordUpdateController; -use App\Http\Controllers\Dashboard\SectionController; -use App\Http\Controllers\Dashboard\SectionSettingsController; -use App\Http\Controllers\Dashboard\SemesterController; -use App\Http\Controllers\Dashboard\SettingController; -use App\Http\Controllers\Dashboard\StudentController; -use App\Http\Controllers\Public\CourseController as PublicCourseController; -use App\Http\Controllers\Public\GradeController as PublicGradeController; -use App\Http\Controllers\Public\HomeController; -use App\Http\Controllers\Public\LoginController; -use App\Http\Controllers\Public\NewsController; use Illuminate\Support\Facades\Route; +use Keating\Http\Controllers\Dashboard\ContactInfoController; +use Keating\Http\Controllers\Dashboard\CourseController; +use Keating\Http\Controllers\Dashboard\CourseSemesterController; +use Keating\Http\Controllers\Dashboard\DashboardController; +use Keating\Http\Controllers\Dashboard\FaqController; +use Keating\Http\Controllers\Dashboard\FieldController; +use Keating\Http\Controllers\Dashboard\GradeController; +use Keating\Http\Controllers\Dashboard\GroupController; +use Keating\Http\Controllers\Dashboard\GroupStudentController; +use Keating\Http\Controllers\Dashboard\LogoutController; +use Keating\Http\Controllers\Dashboard\NewsManagementController; +use Keating\Http\Controllers\Dashboard\PasswordUpdateController; +use Keating\Http\Controllers\Dashboard\SectionController; +use Keating\Http\Controllers\Dashboard\SectionSettingsController; +use Keating\Http\Controllers\Dashboard\SemesterController; +use Keating\Http\Controllers\Dashboard\SettingController; +use Keating\Http\Controllers\Dashboard\StudentController; +use Keating\Http\Controllers\Public\CourseController as PublicCourseController; +use Keating\Http\Controllers\Public\GradeController as PublicGradeController; +use Keating\Http\Controllers\Public\HomeController; +use Keating\Http\Controllers\Public\LoginController; +use Keating\Http\Controllers\Public\NewsController; Route::get("/", HomeController::class)->name("main"); Route::get("/aktualnosci", [NewsController::class, "index"]); diff --git a/tests/Feature/ContactInfoTest.php b/tests/Feature/ContactInfoTest.php index fdeb470..a1b8108 100644 --- a/tests/Feature/ContactInfoTest.php +++ b/tests/Feature/ContactInfoTest.php @@ -4,11 +4,11 @@ namespace Tests\Feature; -use App\Enums\Icons; -use App\Models\ContactInfo; -use App\Models\User; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Support\Str; +use Keating\Enums\Icons; +use Keating\Models\ContactInfo; +use Keating\Models\User; use Tests\TestCase; class ContactInfoTest extends TestCase diff --git a/tests/Feature/CourseSemesterTest.php b/tests/Feature/CourseSemesterTest.php index 33d2d53..015933f 100644 --- a/tests/Feature/CourseSemesterTest.php +++ b/tests/Feature/CourseSemesterTest.php @@ -4,11 +4,11 @@ namespace Tests\Feature; -use App\Models\Course; -use App\Models\CourseSemester; -use App\Models\Semester; -use App\Models\User; use Illuminate\Foundation\Testing\RefreshDatabase; +use Keating\Models\Course; +use Keating\Models\CourseSemester; +use Keating\Models\Semester; +use Keating\Models\User; use Tests\TestCase; class CourseSemesterTest extends TestCase diff --git a/tests/Feature/CourseTest.php b/tests/Feature/CourseTest.php index d169c90..5297c3b 100644 --- a/tests/Feature/CourseTest.php +++ b/tests/Feature/CourseTest.php @@ -4,11 +4,11 @@ namespace Tests\Feature; -use App\Models\Course; -use App\Models\Field; -use App\Models\User; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Support\Str; +use Keating\Models\Course; +use Keating\Models\Field; +use Keating\Models\User; use Tests\TestCase; class CourseTest extends TestCase diff --git a/tests/Feature/ExampleTest.php b/tests/Feature/ExampleTest.php index 0a01957..fb7260d 100644 --- a/tests/Feature/ExampleTest.php +++ b/tests/Feature/ExampleTest.php @@ -4,8 +4,8 @@ namespace Tests\Feature; -use App\Models\SectionSettings; -use App\Models\Setting; +use Keating\Models\SectionSettings; +use Keating\Models\Setting; use Tests\TestCase; class ExampleTest extends TestCase diff --git a/tests/Feature/FaqTest.php b/tests/Feature/FaqTest.php index 7ab705f..d41c9a8 100644 --- a/tests/Feature/FaqTest.php +++ b/tests/Feature/FaqTest.php @@ -4,10 +4,10 @@ namespace Tests\Feature; -use App\Models\Faq; -use App\Models\User; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Support\Str; +use Keating\Models\Faq; +use Keating\Models\User; use Tests\TestCase; class FaqTest extends TestCase diff --git a/tests/Feature/FieldTest.php b/tests/Feature/FieldTest.php index 6a1379b..93a491d 100644 --- a/tests/Feature/FieldTest.php +++ b/tests/Feature/FieldTest.php @@ -4,10 +4,10 @@ namespace Tests\Feature; -use App\Models\Field; -use App\Models\User; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Support\Str; +use Keating\Models\Field; +use Keating\Models\User; use Tests\TestCase; class FieldTest extends TestCase diff --git a/tests/Feature/GradeColumnTest.php b/tests/Feature/GradeColumnTest.php index 8e5931a..496b43b 100644 --- a/tests/Feature/GradeColumnTest.php +++ b/tests/Feature/GradeColumnTest.php @@ -4,11 +4,11 @@ namespace Tests\Feature; -use App\Models\GradeColumn; -use App\Models\Group; -use App\Models\User; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Support\Str; +use Keating\Models\GradeColumn; +use Keating\Models\Group; +use Keating\Models\User; use Tests\TestCase; class GradeColumnTest extends TestCase diff --git a/tests/Feature/GradePageTest.php b/tests/Feature/GradePageTest.php index 97c390d..6b63951 100644 --- a/tests/Feature/GradePageTest.php +++ b/tests/Feature/GradePageTest.php @@ -4,15 +4,15 @@ namespace Tests\Feature; -use App\Models\CourseSemester; -use App\Models\Grade; -use App\Models\GradeColumn; -use App\Models\Group; -use App\Models\SectionSettings; -use App\Models\Setting; -use App\Models\Student; use Illuminate\Foundation\Testing\RefreshDatabase; use Inertia\Testing\AssertableInertia as Assert; +use Keating\Models\CourseSemester; +use Keating\Models\Grade; +use Keating\Models\GradeColumn; +use Keating\Models\Group; +use Keating\Models\SectionSettings; +use Keating\Models\Setting; +use Keating\Models\Student; use Tests\TestCase; class GradePageTest extends TestCase diff --git a/tests/Feature/GradeTest.php b/tests/Feature/GradeTest.php index fe55708..ef6f807 100644 --- a/tests/Feature/GradeTest.php +++ b/tests/Feature/GradeTest.php @@ -4,11 +4,11 @@ namespace Tests\Feature; -use App\Models\Grade; -use App\Models\GradeColumn; -use App\Models\Student; -use App\Models\User; use Illuminate\Foundation\Testing\RefreshDatabase; +use Keating\Models\Grade; +use Keating\Models\GradeColumn; +use Keating\Models\Student; +use Keating\Models\User; use Tests\TestCase; class GradeTest extends TestCase diff --git a/tests/Feature/GroupTest.php b/tests/Feature/GroupTest.php index 3952ca6..c42f8e3 100644 --- a/tests/Feature/GroupTest.php +++ b/tests/Feature/GroupTest.php @@ -4,12 +4,12 @@ namespace Tests\Feature; -use App\Models\CourseSemester; -use App\Models\Group; -use App\Models\Student; -use App\Models\User; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Support\Str; +use Keating\Models\CourseSemester; +use Keating\Models\Group; +use Keating\Models\Student; +use Keating\Models\User; use Tests\TestCase; class GroupTest extends TestCase diff --git a/tests/Feature/LoginTest.php b/tests/Feature/LoginTest.php index 49f6f2a..51aa62d 100644 --- a/tests/Feature/LoginTest.php +++ b/tests/Feature/LoginTest.php @@ -4,9 +4,9 @@ namespace Tests\Feature; -use App\Models\User; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Support\Facades\Hash; +use Keating\Models\User; use Tests\TestCase; class LoginTest extends TestCase diff --git a/tests/Feature/LogoutTest.php b/tests/Feature/LogoutTest.php index 96754b4..604908f 100644 --- a/tests/Feature/LogoutTest.php +++ b/tests/Feature/LogoutTest.php @@ -4,8 +4,8 @@ namespace Tests\Feature; -use App\Models\User; use Illuminate\Foundation\Testing\RefreshDatabase; +use Keating\Models\User; use Tests\TestCase; class LogoutTest extends TestCase diff --git a/tests/Feature/NewsSlugTest.php b/tests/Feature/NewsSlugTest.php index cd748bc..23d8548 100644 --- a/tests/Feature/NewsSlugTest.php +++ b/tests/Feature/NewsSlugTest.php @@ -4,8 +4,8 @@ namespace Tests\Feature; -use App\Models\News; use Illuminate\Foundation\Testing\RefreshDatabase; +use Keating\Models\News; use Tests\TestCase; class NewsSlugTest extends TestCase diff --git a/tests/Feature/NewsTest.php b/tests/Feature/NewsTest.php index befafd7..49197ee 100644 --- a/tests/Feature/NewsTest.php +++ b/tests/Feature/NewsTest.php @@ -4,11 +4,11 @@ namespace Tests\Feature; -use App\Models\News; -use App\Models\User; use Carbon\Carbon; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Support\Str; +use Keating\Models\News; +use Keating\Models\User; use Tests\TestCase; class NewsTest extends TestCase diff --git a/tests/Feature/PasswordUpdateTest.php b/tests/Feature/PasswordUpdateTest.php index ae78bba..f8cd4f7 100644 --- a/tests/Feature/PasswordUpdateTest.php +++ b/tests/Feature/PasswordUpdateTest.php @@ -4,10 +4,10 @@ namespace Tests\Feature; -use App\Models\User; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Support\Facades\Hash; use JsonException; +use Keating\Models\User; use Tests\TestCase; class PasswordUpdateTest extends TestCase diff --git a/tests/Feature/SectionsTest.php b/tests/Feature/SectionsTest.php index badc9f6..d3527a4 100644 --- a/tests/Feature/SectionsTest.php +++ b/tests/Feature/SectionsTest.php @@ -4,11 +4,11 @@ namespace Tests\Feature; -use App\Models\Section; -use App\Models\SectionSettings; -use App\Models\User; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Support\Str; +use Keating\Models\Section; +use Keating\Models\SectionSettings; +use Keating\Models\User; use Tests\TestCase; class SectionsTest extends TestCase diff --git a/tests/Feature/SemesterTest.php b/tests/Feature/SemesterTest.php index 04c7739..dd8b9ef 100644 --- a/tests/Feature/SemesterTest.php +++ b/tests/Feature/SemesterTest.php @@ -4,10 +4,10 @@ namespace Tests\Feature; -use App\Models\Semester; -use App\Models\User; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Support\Str; +use Keating\Models\Semester; +use Keating\Models\User; use Tests\TestCase; class SemesterTest extends TestCase diff --git a/tests/Feature/SettingsTest.php b/tests/Feature/SettingsTest.php index f252b8c..1bf9532 100644 --- a/tests/Feature/SettingsTest.php +++ b/tests/Feature/SettingsTest.php @@ -4,12 +4,12 @@ namespace Tests\Feature; -use App\Models\Setting; -use App\Models\User; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Http\UploadedFile; use Illuminate\Support\Facades\Storage; use Illuminate\Support\Str; +use Keating\Models\Setting; +use Keating\Models\User; use Tests\TestCase; class SettingsTest extends TestCase diff --git a/tests/Feature/StudentImportTest.php b/tests/Feature/StudentImportTest.php index 94c3b08..57532c0 100644 --- a/tests/Feature/StudentImportTest.php +++ b/tests/Feature/StudentImportTest.php @@ -4,9 +4,9 @@ namespace Tests\Feature; -use App\Actions\WuStudentsImport; -use App\Models\Student; use Illuminate\Foundation\Testing\RefreshDatabase; +use Keating\Actions\WuStudentsImport; +use Keating\Models\Student; use Tests\TestCase; class StudentImportTest extends TestCase diff --git a/tests/Feature/StudentTest.php b/tests/Feature/StudentTest.php index e50d990..50bef7f 100644 --- a/tests/Feature/StudentTest.php +++ b/tests/Feature/StudentTest.php @@ -4,10 +4,10 @@ namespace Tests\Feature; -use App\Models\Student; -use App\Models\User; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Support\Str; +use Keating\Models\Student; +use Keating\Models\User; use Tests\TestCase; class StudentTest extends TestCase diff --git a/tests/Feature/UnaccentSearchTest.php b/tests/Feature/UnaccentSearchTest.php index 59e694c..c66e85d 100644 --- a/tests/Feature/UnaccentSearchTest.php +++ b/tests/Feature/UnaccentSearchTest.php @@ -4,11 +4,11 @@ namespace Tests\Feature; -use App\Models\Student; -use App\Models\User; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Support\Facades\DB; use Inertia\Testing\AssertableInertia as Assert; +use Keating\Models\Student; +use Keating\Models\User; use Tests\TestCase; class UnaccentSearchTest extends TestCase From 4b65078b554ce7596d97fa36b466d41018c0a050 Mon Sep 17 00:00:00 2001 From: Krzysztof Rewak Date: Wed, 21 Aug 2024 14:54:54 +0200 Subject: [PATCH 2/4] #78 - recaching settings (#132) --- app/Models/Setting.php | 3 +++ app/Observers/SettingObserver.php | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 app/Observers/SettingObserver.php diff --git a/app/Models/Setting.php b/app/Models/Setting.php index a925bea..7095fbd 100644 --- a/app/Models/Setting.php +++ b/app/Models/Setting.php @@ -5,9 +5,11 @@ namespace Keating\Models; use Carbon\Carbon; +use Illuminate\Database\Eloquent\Attributes\ObservedBy; use Illuminate\Database\Eloquent\Concerns\HasUlids; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Keating\Observers\SettingObserver; /** * @property string $id @@ -19,6 +21,7 @@ * @property Carbon $created_at * @property Carbon $updated_at */ +#[ObservedBy(SettingObserver::class)] class Setting extends Model { use HasFactory; diff --git a/app/Observers/SettingObserver.php b/app/Observers/SettingObserver.php new file mode 100644 index 0000000..dc909c2 --- /dev/null +++ b/app/Observers/SettingObserver.php @@ -0,0 +1,19 @@ +cache->forget("pageTitle"); + } +} From 9aba222acebdec123350354693f4cd57f5905ca6 Mon Sep 17 00:00:00 2001 From: Kamil Piech Date: Wed, 21 Aug 2024 14:56:15 +0200 Subject: [PATCH 3/4] #128 - dto (#130) * #128 - fix: removed laravel resources, added some dtos classes * #128 - fix: removed all laravel resources --- app/DTOs/CourseData.php | 32 +++++++++++++ app/DTOs/CoursePublicData.php | 46 +++++++++++++++++++ app/DTOs/CourseSemesterData.php | 29 ++++++++++++ app/DTOs/FieldData.php | 25 ++++++++++ app/DTOs/GroupData.php | 28 +++++++++++ .../Dashboard/CourseController.php | 10 ++-- .../Dashboard/CourseSemesterController.php | 10 ++-- .../Controllers/Dashboard/GradeController.php | 4 +- .../Dashboard/GroupStudentController.php | 4 +- .../Controllers/Public/CourseController.php | 6 +-- app/Http/Resources/CoursePublicResource.php | 45 ------------------ app/Http/Resources/CourseResource.php | 28 ----------- app/Http/Resources/CourseSemesterResource.php | 26 ----------- app/Http/Resources/FieldResource.php | 26 ----------- app/Http/Resources/GroupResource.php | 26 ----------- resources/js/Pages/Dashboard/Course/Index.vue | 4 +- 16 files changed, 179 insertions(+), 170 deletions(-) create mode 100644 app/DTOs/CourseData.php create mode 100644 app/DTOs/CoursePublicData.php create mode 100644 app/DTOs/CourseSemesterData.php create mode 100644 app/DTOs/FieldData.php create mode 100644 app/DTOs/GroupData.php delete mode 100644 app/Http/Resources/CoursePublicResource.php delete mode 100644 app/Http/Resources/CourseResource.php delete mode 100644 app/Http/Resources/CourseSemesterResource.php delete mode 100644 app/Http/Resources/FieldResource.php delete mode 100644 app/Http/Resources/GroupResource.php diff --git a/app/DTOs/CourseData.php b/app/DTOs/CourseData.php new file mode 100644 index 0000000..1581059 --- /dev/null +++ b/app/DTOs/CourseData.php @@ -0,0 +1,32 @@ +id, + name: $course->name, + abbreviation: $course->abbreviation, + description: $course->description, + semester: $course->getRomanizedSemester(), + type: ClassType::labels()[$course->type], + ); + } +} diff --git a/app/DTOs/CoursePublicData.php b/app/DTOs/CoursePublicData.php new file mode 100644 index 0000000..f689701 --- /dev/null +++ b/app/DTOs/CoursePublicData.php @@ -0,0 +1,46 @@ +id, + name: $course->name, + abbreviation: $course->abbreviation, + slug: $course->slug, + description: $course->description, + semester: $course->getRomanizedSemester(), + semesterName: SemesterName::labels()[$course->semester_name], + type: ClassType::labels()[$course->type], + typeAbbreviation: ClassType::abbreviationLabels()[$course->type], + field: $course->field->name, + fieldAbbreviation: $course->field->abbreviation, + active: $activeSemesters && ($activeSemesters->contains($course->getRomanizedSemester()) || $activeSemesters->contains($course->semester)), + ); + } +} diff --git a/app/DTOs/CourseSemesterData.php b/app/DTOs/CourseSemesterData.php new file mode 100644 index 0000000..f9cf7f2 --- /dev/null +++ b/app/DTOs/CourseSemesterData.php @@ -0,0 +1,29 @@ +id, + course: $course->course->name, + semester: $course->semester->name, + semesterId: $course->semester->id, + groupsCount: $course->groups_count ?? $course->groups->count(), + ); + } +} diff --git a/app/DTOs/FieldData.php b/app/DTOs/FieldData.php new file mode 100644 index 0000000..5bb2412 --- /dev/null +++ b/app/DTOs/FieldData.php @@ -0,0 +1,25 @@ +id, + name: $field->name, + abbreviation: $field->abbreviation, + ); + } +} diff --git a/app/DTOs/GroupData.php b/app/DTOs/GroupData.php new file mode 100644 index 0000000..260ca79 --- /dev/null +++ b/app/DTOs/GroupData.php @@ -0,0 +1,28 @@ +id, + name: $group->name, + formAbbreviation: StudyForm::abbreviationLabels()[$group->form->value], + form: $group->form->value, + ); + } +} diff --git a/app/Http/Controllers/Dashboard/CourseController.php b/app/Http/Controllers/Dashboard/CourseController.php index aa793a4..6f43c73 100644 --- a/app/Http/Controllers/Dashboard/CourseController.php +++ b/app/Http/Controllers/Dashboard/CourseController.php @@ -6,12 +6,12 @@ use Illuminate\Http\RedirectResponse; use Inertia\Response; +use Keating\DTOs\CourseData; +use Keating\DTOs\FieldData; use Keating\Enums\ClassType; use Keating\Enums\SemesterName; use Keating\Enums\StudyForm; use Keating\Http\Requests\CourseRequest; -use Keating\Http\Resources\CourseResource; -use Keating\Http\Resources\FieldResource; use Keating\Models\Course; use Keating\Models\Field; use Spatie\LaravelOptions\Options; @@ -25,7 +25,7 @@ public function index(): Response ->get(); return inertia("Dashboard/Course/Index", [ - "courses" => CourseResource::collection($courses), + "courses" => $courses->map(fn(Course $course): CourseData => CourseData::fromModel($course)), "total" => Course::query()->count(), "lastUpdate" => Course::query()->orderByDesc("updated_at")->first()?->updated_at->diffForHumans(), ]); @@ -41,7 +41,7 @@ public function create(): Response "classTypes" => Options::forEnum(ClassType::class)->toArray(), "studyForms" => Options::forEnum(StudyForm::class)->toArray(), "semesterNames" => Options::forEnum(SemesterName::class)->toArray(), - "fields" => FieldResource::collection($fields)->resolve(), + "fields" => $fields->map(fn(Field $field) => FieldData::fromModel($field)), ]); } @@ -65,7 +65,7 @@ public function edit(Course $course): Response "classTypes" => Options::forEnum(ClassType::class)->toArray(), "studyForms" => Options::forEnum(StudyForm::class)->toArray(), "semesterNames" => Options::forEnum(SemesterName::class)->toArray(), - "fields" => FieldResource::collection($fields)->resolve(), + "fields" => $fields->map(fn(Field $field) => FieldData::fromModel($field)), ]); } diff --git a/app/Http/Controllers/Dashboard/CourseSemesterController.php b/app/Http/Controllers/Dashboard/CourseSemesterController.php index a9648bb..7ddfff9 100644 --- a/app/Http/Controllers/Dashboard/CourseSemesterController.php +++ b/app/Http/Controllers/Dashboard/CourseSemesterController.php @@ -6,10 +6,10 @@ use Illuminate\Http\RedirectResponse; use Inertia\Response; +use Keating\DTOs\CourseSemesterData; +use Keating\DTOs\GroupData; use Keating\Enums\StudyForm; use Keating\Http\Requests\CourseSemesterRequest; -use Keating\Http\Resources\CourseSemesterResource; -use Keating\Http\Resources\GroupResource; use Keating\Models\Course; use Keating\Models\CourseSemester; use Keating\Models\Semester; @@ -25,7 +25,7 @@ public function index(): Response ->get(); return inertia("Dashboard/CourseSemester/Index", [ - "courses" => CourseSemesterResource::collection($courses), + "courses" => $courses->map(fn(CourseSemester $course): CourseSemesterData => CourseSemesterData::fromModel($course)), "activeSemester" => Semester::getActive(), "total" => Course::query()->count(), "lastUpdate" => CourseSemester::query()->orderByDesc("updated_at")->first()?->updated_at->diffForHumans(), @@ -52,8 +52,8 @@ public function store(CourseSemesterRequest $request): RedirectResponse public function show(CourseSemester $course): Response { return inertia("Dashboard/CourseSemester/Show", [ - "course" => new CourseSemesterResource($course->load("groups")), - "groups" => GroupResource::collection($course->groups), + "course" => CourseSemesterData::fromModel($course), + "groups" => $course->groups->map(fn($group): GroupData => GroupData::fromModel($group)), "studyForms" => Options::forEnum(StudyForm::class)->toArray(), ]); } diff --git a/app/Http/Controllers/Dashboard/GradeController.php b/app/Http/Controllers/Dashboard/GradeController.php index 5709684..507908f 100644 --- a/app/Http/Controllers/Dashboard/GradeController.php +++ b/app/Http/Controllers/Dashboard/GradeController.php @@ -8,9 +8,9 @@ use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Inertia\Response; +use Keating\DTOs\CourseSemesterData; use Keating\Http\Requests\UpdateGrade; use Keating\Http\Requests\UpdateGradeColumn; -use Keating\Http\Resources\CourseSemesterResource; use Keating\Models\CourseSemester; use Keating\Models\GradeColumn; use Keating\Models\Group; @@ -31,7 +31,7 @@ public function index(Request $request, CourseSemester $course, Group $group): R ->withQueryString(); return inertia("Dashboard/CourseSemester/Grade/Index", [ - "course" => new CourseSemesterResource($course), + "course" => CourseSemesterData::fromModel($course), "group" => $group, "total" => $group->students->count(), "students" => $students, diff --git a/app/Http/Controllers/Dashboard/GroupStudentController.php b/app/Http/Controllers/Dashboard/GroupStudentController.php index 16b008b..1df3674 100644 --- a/app/Http/Controllers/Dashboard/GroupStudentController.php +++ b/app/Http/Controllers/Dashboard/GroupStudentController.php @@ -8,7 +8,7 @@ use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Inertia\Response; -use Keating\Http\Resources\CourseSemesterResource; +use Keating\DTOs\CourseSemesterData; use Keating\Models\CourseSemester; use Keating\Models\Group; use Keating\Models\Student; @@ -33,7 +33,7 @@ public function index(Request $request, CourseSemester $course, Group $group): R : []; return inertia("Dashboard/CourseSemester/Student/Index", [ - "course" => new CourseSemesterResource($course), + "course" => CourseSemesterData::fromModel($course), "group" => $group, "students" => $students, "availableStudents" => $availableStudents, diff --git a/app/Http/Controllers/Public/CourseController.php b/app/Http/Controllers/Public/CourseController.php index 8e01084..db60712 100644 --- a/app/Http/Controllers/Public/CourseController.php +++ b/app/Http/Controllers/Public/CourseController.php @@ -5,7 +5,7 @@ namespace Keating\Http\Controllers\Public; use Inertia\Response; -use Keating\Http\Resources\CoursePublicResource as CourseResource; +use Keating\DTOs\CoursePublicData; use Keating\Models\Course; use Keating\Models\Semester; @@ -20,7 +20,7 @@ public function index(): Response $courses = Course::query() ->with("field") ->get() - ->map(fn(Course $course): array => (new CourseResource($course, $activeSemesters))->resolve()) + ->map(fn(Course $course): CoursePublicData => CoursePublicData::fromModel($course, $activeSemesters)) ->sortBy("semester") ->sortByDesc("active"); @@ -36,7 +36,7 @@ public function get(string $slug): Response ->firstOrFail(); return inertia("Public/Course/Course", [ - "course" => new CourseResource($course, collect()), + "course" => CoursePublicData::fromModel($course), ]); } } diff --git a/app/Http/Resources/CoursePublicResource.php b/app/Http/Resources/CoursePublicResource.php deleted file mode 100644 index 6f37f6c..0000000 --- a/app/Http/Resources/CoursePublicResource.php +++ /dev/null @@ -1,45 +0,0 @@ - $course->id, - "name" => $course->name, - "abbreviation" => $course->abbreviation, - "slug" => $course->slug, - "description" => $course->description, - "semester" => $course->getRomanizedSemester(), - "semesterName" => SemesterName::labels()[$course->semester_name], - "type" => ClassType::labels()[$course->type], - "typeAbbreviation" => ClassType::abbreviationLabels()[$course->type], - "field" => $course->field->name, - "fieldAbbreviation" => $course->field->abbreviation, - "active" => $this->activeSemesters->contains($course->getRomanizedSemester()) || $this->activeSemesters->contains($course->semester), - ]; - } -} diff --git a/app/Http/Resources/CourseResource.php b/app/Http/Resources/CourseResource.php deleted file mode 100644 index 3c6bdbc..0000000 --- a/app/Http/Resources/CourseResource.php +++ /dev/null @@ -1,28 +0,0 @@ - $course->id, - "name" => $course->name, - "abbreviation" => $course->abbreviation, - "description" => $course->description, - "semester" => $course->getRomanizedSemester(), - "type" => ClassType::labels()[$course->type], - ]; - } -} diff --git a/app/Http/Resources/CourseSemesterResource.php b/app/Http/Resources/CourseSemesterResource.php deleted file mode 100644 index 302f74d..0000000 --- a/app/Http/Resources/CourseSemesterResource.php +++ /dev/null @@ -1,26 +0,0 @@ - $course->id, - "course" => $course->course->name, - "semester" => $course->semester->name, - "semesterId" => $course->semester->id, - "groupsCount" => $course->groups_count ?? $course->groups->count(), - ]; - } -} diff --git a/app/Http/Resources/FieldResource.php b/app/Http/Resources/FieldResource.php deleted file mode 100644 index 45a9913..0000000 --- a/app/Http/Resources/FieldResource.php +++ /dev/null @@ -1,26 +0,0 @@ - $field->id, - "name" => $field->name, - "abbreviation" => $field->abbreviation, - ]; - } -} diff --git a/app/Http/Resources/GroupResource.php b/app/Http/Resources/GroupResource.php deleted file mode 100644 index 2354b5d..0000000 --- a/app/Http/Resources/GroupResource.php +++ /dev/null @@ -1,26 +0,0 @@ - $group->id, - "name" => $group->name, - "formAbbreviation" => StudyForm::abbreviationLabels()[$group->form->value], - "form" => $group->form->value, - ]; - } -} diff --git a/resources/js/Pages/Dashboard/Course/Index.vue b/resources/js/Pages/Dashboard/Course/Index.vue index a084cef..d6dfb60 100644 --- a/resources/js/Pages/Dashboard/Course/Index.vue +++ b/resources/js/Pages/Dashboard/Course/Index.vue @@ -44,7 +44,7 @@ const courseToDeleteId = ref(0) -
+