Compare commits

...

69 Commits

Author SHA1 Message Date
ROMANGOLIENKO 88919c251d Merge remote-tracking branch 'origin/new-design' into new-design 2024-02-16 13:40:13 +03:00
ROMANGOLIENKO 4e5d567720 new design (blue) 2024-02-16 13:39:57 +03:00
ROMANGOLIENKO c4d11de8ad design variations 2024-02-15 11:33:49 +03:00
ROMANGOLIENKO dc54ec6b74 design changes for admin-layout.blade.php and reception-screen.blade.php 2024-02-15 11:33:49 +03:00
aslan 9beeeb4edb add field education form to show Direction 2024-02-15 10:19:35 +03:00
aslan 8cf5631f5a add Education Form resource 2024-02-15 09:58:01 +03:00
aslan 17625fd0d4 fix lint delete comments 2024-02-14 17:12:33 +03:00
aslan 454a4a6d96 fix lint 2024-02-14 16:41:51 +03:00
aslan e7818471db refactoring Requests max characters and numeric field 2024-02-14 16:41:19 +03:00
aslan 6954e296d6 refactoring migrations nullable or not 2024-02-14 16:19:31 +03:00
aslan 639a8c92af add Education Level test 2024-02-14 16:16:44 +03:00
aslan 75899051c7 add Education Level resource 2024-02-14 15:00:28 +03:00
aslan 295d7a5711 fix update unique name 2024-02-14 14:08:28 +03:00
aslan d9b8f8be33 delete unused element 2024-02-14 13:54:18 +03:00
aslan 6a4c2253d1 move views from menu to pages 2024-02-14 13:31:15 +03:00
aslan 52d3d7af09 fix lint 2024-02-14 10:29:17 +03:00
aslan 83a398c5bc fix lint 120 char per line 2024-02-14 10:22:04 +03:00
aslan 0cdc43d547 refactoring User resource 2024-02-14 10:20:40 +03:00
aslan a5f8751f94 refactoring User resource 2024-02-14 10:18:45 +03:00
aslan fc706fce82 refactoring User resource 2024-02-14 09:54:11 +03:00
aslan 2a21e25200 fix field description from string to text 2024-02-14 09:49:56 +03:00
aslan 1659980a2e refactoring Admission and Document resource 2024-02-14 09:46:41 +03:00
aslan 5a462a0823 add field URL to show views from department, direction, documents 2024-02-14 09:45:55 +03:00
aslan 4b094339f0 refactoring Document and Admission resource 2024-02-14 09:44:53 +03:00
aslan fffd4c3310 refactoring views, rename routes 2024-02-13 16:01:03 +03:00
aslan 968a4b06c8 refactoring requests rules 2024-02-13 15:38:30 +03:00
aslan 3e50dee628 refactoring Reception screen to Admission 2024-02-13 15:37:41 +03:00
aslan 551864fbb8 refactoring rename admin view 2024-02-12 15:02:31 +03:00
aslan 94300bee31 refactoring Service Layer 2024-02-12 14:56:24 +03:00
aslan 1f67f437f3 refactoring EducationalInstitution resource 2024-02-12 14:55:17 +03:00
aslan 173a744f79 refactoring routes 2024-02-12 14:52:55 +03:00
aslan f391a26b7d refactoring Faculty resource 2024-02-12 12:15:46 +03:00
aslan 54765f6202 refactoring Departments and Directions 2024-02-12 11:25:00 +03:00
aslan 07cb065e1c add FOREIGN KEY direction and department 2024-02-12 11:05:45 +03:00
aslan c5abf73eb0 refactoring fix lint Direction resource 2024-02-12 10:58:48 +03:00
aslan 1091847227 refactoring fix lint Department resource 2024-02-12 10:39:46 +03:00
aslan 7d4461e231 add tests to Department resource 2024-02-12 10:27:08 +03:00
aslan 35104455c2 refactoring Department resource 2024-02-12 09:19:08 +03:00
aslan abfa800707 refactoring regroup requests 2024-02-10 15:45:23 +03:00
aslan b07fb7648f refactoring delete not used elements 2024-02-10 15:14:02 +03:00
aslan afebc7ea6c fix CI 2024-02-10 15:01:57 +03:00
aslan 559d925c51 fix CI 2024-02-10 14:47:45 +03:00
aslan b75c784cdf fix CI 2024-02-10 14:46:03 +03:00
aslan 8e18821812 fix CI 2024-02-10 14:36:40 +03:00
aslan 447f8f5552 fix CI 2024-02-10 14:32:50 +03:00
aslan caafa73a1b fix CI 2024-02-10 14:30:32 +03:00
aslan eb4206e86d fix CI 2024-02-10 14:26:16 +03:00
aslan 023dba341a fix CI 2024-02-10 14:21:43 +03:00
aslan 3d14987fcb fix CI 2024-02-10 14:10:57 +03:00
aslan 03690516f5 fix CI 2024-02-10 14:10:13 +03:00
aslan 95f2c72231 fix CI 2024-02-10 14:06:34 +03:00
aslan 98a2dd92f8 fix CI 2024-02-10 14:06:05 +03:00
aslan 3da2646052 fix CI 2024-02-10 12:43:55 +03:00
aslan 9ebb8e8372 fix CI 2024-02-10 12:42:09 +03:00
aslan 887d946558 fix CI 2024-02-10 12:38:00 +03:00
aslan a2a00831ad fix CI 2024-02-10 12:22:06 +03:00
aslan 490c04f772 fix CI 2024-02-10 12:20:06 +03:00
aslan f1442e66d8 fix CI 2024-02-10 12:04:50 +03:00
aslan 4cbf0cadda fix CI 2024-02-10 11:58:47 +03:00
aslan 56d4f387b8 add Direction resource 2024-02-10 11:23:38 +03:00
aslan fe8e9c94c0 rename fileController to DocumentController 2024-02-09 14:31:12 +03:00
aslan de6b83d675 refactoring routes 2024-02-09 14:30:42 +03:00
aslan 2279341988 change resorce scoping
https://laravel.com/docs/10.x/controllers#restful-scoping-resource-routes
2024-02-08 18:34:45 +03:00
aslan 397f0faf19 add DEMO-url to README.md 2024-02-08 16:21:24 +03:00
aslan 287c0eac76 add seeders 2024-02-08 16:20:05 +03:00
aslan 1491d8b425 Merge remote-tracking branch 'origin/main' 2024-02-08 16:01:46 +03:00
aslan 00266b9fa0 Refactoring Faculty and Education Institution views 2024-02-08 16:01:40 +03:00
aslan 3ef7a84f7e add Department resource 2024-02-08 16:00:06 +03:00
aslan 953a6b3631 add Department resource 2024-02-08 15:59:44 +03:00
170 changed files with 4218 additions and 1639 deletions

View File

@ -4,6 +4,9 @@ APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
ADMIN_NAME=admin
ADMIN_EMAIL=test@example.com
LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

View File

@ -14,16 +14,23 @@ jobs:
strategy:
matrix:
php-versions: [ '8.3' ]
php-version: [ '8.3' ]
node-version: ['20.x']
composer-version: ['2.6.6']
steps:
- uses: actions/checkout@v4
- name: Set up PHP ${{ matrix.php-versions }}
- name: Set up PHP ${{ matrix.php-version }} with extensions and tools
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
php-version: ${{ matrix.php-version }}
coverage: xdebug
extensions: mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite
tools: composer:${{ matrix.composer-version }}
ini-values: opcache.enable_cli=1, opcache.jit=tracing, opcache.jit_buffer_size=64M
env:
debug: true
- name: PHP Security Checker
uses: StephaneBour/actions-php-security-checker@1.1
@ -37,22 +44,14 @@ jobs:
run: |
sudo curl -o ~/.composer/keys.tags.pub -sL https://composer.github.io/releases.pub
sudo curl -o ~/.composer/keys.dev.pub -sL https://composer.github.io/snapshots.pub
- run: echo $COMPOSER_AUTH|jq -r '.["github-oauth"]["github.com"]'|base64
- run: echo $GITHUB_TOKEN|base64
- name: Diagnose composer
env:
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH_JSON }} # only this works
run: composer diagnose -vvv
- name: Install dependencies
env:
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH_JSON }} # only this works
run: composer install # will work
- name: Setup sqlite3 driver
run: apt install php${{ matrix.php-versions }}-sqlite3 -y
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH_JSON }}
run: composer install
- name: Setup project
run: make setup
run: make setup-test
- name: Check lint
run: make lint
@ -64,7 +63,7 @@ jobs:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
- name: deploy to test server
uses: appleboy/ssh-action@v1.0.3
with:
@ -76,4 +75,5 @@ jobs:
cd /var/www/test-testabit/
git stash
git pull --rebase
git stash clear
make setup-test

View File

@ -16,11 +16,11 @@ setup:
make ide-helper
setup-test:
composer install --no-plugins --no-scripts
composer install
cp -n .env.example .env
php artisan key:gen --ansi
rm database/database.sqlite
touch database/database.sqlite
php artisan migrate
php artisan migrate:refresh
php artisan db:seed
npm ci
npm run build

View File

@ -2,7 +2,11 @@
Сайт с Админкой для редактирования Экрана приема
Сайт:
```text
Сайт: http://test-testabit.mkgtu.ru
логин: test@example.com
пароль: 123456
```
## Requirements:
- PHP ^8.2
@ -16,6 +20,7 @@ git clone http://172.17.254.104/aslan/applicant-site.git
cd applicant-site
make setup
```
2255
## Project start local

View File

@ -1,109 +0,0 @@
<?php
namespace App\Http\Controllers;
use App\Http\Requests\StoreFileRequest;
use App\Http\Requests\StoreReceptionScreenRequest;
use App\Http\Requests\UpdateFileRequest;
use App\Http\Requests\UpdateReceptionScreenRequest;
use App\Models\File;
use App\Models\ReceptionScreen;
use App\Services\WorkWithFiles;
use Carbon\Carbon;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Illuminate\Foundation\Application;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Storage;
class FileController extends Controller
{
public function __construct()
{
$this->middleware('auth');
}
public function index(): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{
abort_if(Auth::guest(), 403);
$files = File::all()->sortBy('position');
return view('files.index', compact('files'));
}
public function create($idReceptionScreen = null): View
{
abort_if(Auth::guest(), 403);
$receptionScreens = ReceptionScreen::pluck('name', 'id');
$files = File::where('reception_screen_id', '=', $idReceptionScreen)->get();
return view('files.create', compact('receptionScreens', 'idReceptionScreen', 'files'));
}
public function store(StoreFileRequest $request)
{
abort_if(Auth::guest(), 403);
$nameFile = $request->file('url')->getClientOriginalName();
$name = Storage::put('public', $request->file('url'));
$validated = $request->validated();
$file = new File();
$file->name = $validated['name'];
$file->file_name = $nameFile;
$file->url = Storage::url($name);
$file->position = $validated['position'];
$file->reception_screen_id = $validated['idReceptionScreen'];
$file->save();
return redirect()->route('files.index');
}
public function download($id)
{
$file = (new File())->find($id);
return Storage::url($file->url);
}
public function edit(int $idFile)
{
abort_if(Auth::guest(), 403);
$file = (new File())->find($idFile);
$files = File::where('reception_screen_id', '=', $file->reception_screen_id)->get();
$receptionScreens = ReceptionScreen::pluck('name', 'id');
$idsReceptionScreens = $receptionScreens->keys()->toArray();
$idReceptionScreen = $file->reception_screen_id;
return view(
'files.edit',
compact(
'receptionScreens',
'idsReceptionScreens',
'idReceptionScreen',
'files',
'file'
)
);
}
public function update(UpdateFileRequest $request, File $file)
{
abort_if(Auth::guest(), 403);
$validated = $request->validated();
$file->name = $validated['name'];
$file->position = $validated['position'];
$file->reception_screen_id = $validated['idReceptionScreen'];
$file->save();
return redirect()->route('admin-reception-screen.index');
}
public function destroy($idFile)
{
abort_if(Auth::guest(), 403);
$file = (new File())->find($idFile);
$file->delete();
return redirect()->route('admin-reception-screen.index');
}
}

View File

@ -1,82 +0,0 @@
<?php
namespace App\Http\Controllers;
use App\Http\Requests\StoreReceptionScreenRequest;
use App\Http\Requests\UpdateReceptionScreenRequest;
use App\Models\ReceptionScreen;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Illuminate\Foundation\Application;
use Illuminate\Support\Facades\Auth;
class ReceptionScreenController extends Controller
{
public function __construct()
{
$this->middleware('auth');
}
public function index(): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{
abort_if(Auth::guest(), 403);
$receptionScreens = ReceptionScreen::all()->sortBy('position');
return view('admin-reception-screen.index', compact('receptionScreens'));
}
public function create(): View
{
abort_if(Auth::guest(), 403);
$receptionScreens = ReceptionScreen::all()->sortBy('position');
return view('admin-reception-screen.create', compact('receptionScreens'));
}
public function store(StoreReceptionScreenRequest $request)
{
abort_if(Auth::guest(), 403);
$validated = $request->validated();
$receptionScreen = new ReceptionScreen();
$receptionScreen->name = $validated['name'];
$receptionScreen->position = $validated['position'];
$receptionScreen->save();
return redirect()->route('admin-reception-screen.index');
}
public function edit($id)
{
abort_if(Auth::guest(), 403);
$receptionScreen = new ReceptionScreen();
$currentReceptionScreen = $receptionScreen->find($id);
$receptionScreens = $receptionScreen->all()->sortBy('position');
return view('admin-reception-screen.edit', compact('currentReceptionScreen', 'receptionScreens'));
}
public function update(UpdateReceptionScreenRequest $request, $id)
{
abort_if(Auth::guest(), 403);
$validated = $request->validated();
$receptionScreen = new ReceptionScreen();
$currentReceptionScreen = $receptionScreen->find($id);
$currentReceptionScreen->name = $validated['name'];
$currentReceptionScreen->position = $validated['position'];
$currentReceptionScreen->save();
return redirect()->route('admin-reception-screen.index');
}
public function destroy($id)
{
$receptionScreen = new ReceptionScreen();
$currentReceptionScreen = $receptionScreen->find($id);
if ($currentReceptionScreen->files()->exists()) {
return back();
}
$currentReceptionScreen->delete();
return redirect()->route('admin-reception-screen.index');
}
}

View File

@ -0,0 +1,72 @@
<?php
namespace App\Http\Controllers\admin;
use App\Http\Controllers\Controller;
use App\Http\Requests\admin\StoreAdmissionRequest;
use App\Http\Requests\admin\UpdateAdmissionRequest;
use App\Models\Admission;
class AdmissionController extends Controller
{
public function index()
{
$admissions = Admission::all()->sortBy('position');
return view('admin.admission.index', compact('admissions'));
}
public function create()
{
$admissions = Admission::all()->sortBy('position');
return view('admin.admission.create', compact('admissions'));
}
public function store(StoreAdmissionRequest $request)
{
$validated = $request->validated();
$admission = new Admission();
$admission->name = $validated['name'];
$admission->description = $validated['description'];
$admission->slug = $validated['slug'];
$admission->position = $validated['position'];
$admission->save();
return redirect()->route('admissions.index');
}
public function show(Admission $admission)
{
return view('admin.admission.show', compact('admission'));
}
public function edit(Admission $admission)
{
return view('admin.admission.edit', compact('admission'));
}
public function update(UpdateAdmissionRequest $request, Admission $admission)
{
$validated = $request->validated();
$admission->name = $validated['name'];
$admission->description = $validated['description'];
$admission->slug = $validated['slug'];
$admission->position = $validated['position'];
$admission->save();
return redirect()->route('admissions.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy(Admission $admission)
{
if ($admission->documents()->exists()) {
return back();
}
$admission->delete();
return redirect()->route('admissions.index');
}
}

View File

@ -0,0 +1,79 @@
<?php
namespace App\Http\Controllers\admin\Catalog;
use App\Http\Controllers\Controller;
use App\Http\Requests\admin\Catalog\StoreDepartmentRequest;
use App\Http\Requests\admin\Catalog\UpdateDepartmentRequest;
use App\Models\Department;
use App\Models\Faculty;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Illuminate\Foundation\Application;
use Illuminate\Http\RedirectResponse;
class DepartmentController extends Controller
{
public function index(): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{
$departments = Department::all();
return view('admin.catalog.department.index', compact('departments'));
}
public function create(): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{
$faculties = Faculty::pluck('name', 'id');
return view('admin.catalog.department.create', compact('faculties'));
}
public function store(StoreDepartmentRequest $request): RedirectResponse
{
$validated = $request->validated();
$department = new Department();
$department->name = $validated['name'];
$department->description = $validated['description'];
$department->position = $validated['position'];
$department->faculty_id = $validated['faculty_id'];
$department->slug = $validated['slug'];
$department->save();
return redirect()->route('departments.index');
}
public function show(Department $department): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{
$faculty = Faculty::find($department->faculty->id);
$educationalInstitution = $faculty->educationalInstitution;
return view('admin.catalog.department.show', compact('department', 'faculty', 'educationalInstitution'));
}
public function edit(Department $department): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{
$faculties = Faculty::pluck('name', 'id');
return view('admin.catalog.department.edit', compact('department', 'faculties'));
}
public function update(UpdateDepartmentRequest $request, Department $department): RedirectResponse
{
$validated = $request->validated();
$department->name = $validated['name'];
$department->description = $validated['description'];
$department->position = $validated['position'];
$department->faculty_id = $validated['faculty_id'];
$department->slug = $validated['slug'];
$department->save();
return redirect()->route('departments.index');
}
public function destroy(Department $department): RedirectResponse
{
if ($department->directions()->exists()) {
return back();
}
$department->delete();
return redirect()->route('departments.index');
}
}

View File

@ -0,0 +1,99 @@
<?php
namespace App\Http\Controllers\admin\Catalog;
use App\Http\Controllers\Controller;
use App\Http\Requests\admin\Catalog\StoreDirectionRequest;
use App\Http\Requests\admin\Catalog\UpdateDirectionRequest;
use App\Models\Department;
use App\Models\Direction;
use App\Models\EducationForm;
use App\Models\EducationLevel;
use App\Models\Faculty;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Illuminate\Foundation\Application;
use Illuminate\Http\RedirectResponse;
class DirectionController extends Controller
{
public function index(): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{
$directions = Direction::all();
return view('admin.catalog.direction.index', compact('directions'));
}
public function create(): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{
$levels = EducationLevel::pluck('name', 'id');
$forms = EducationForm::pluck('name', 'id');
$departments = Department::pluck('name', 'id');
return view('admin.catalog.direction.create', compact('departments', 'levels', 'forms'));
}
public function store(StoreDirectionRequest $request): RedirectResponse
{
$validated = $request->validated();
$direction = new Direction();
$direction->name = $validated['name'];
$direction->description = $validated['description'];
$direction->position = $validated['position'];
$direction->slug = $validated['slug'];
$direction->code = $validated['code'];
$direction->education_level_id = $validated['education_level_id'];
$direction->education_form_id = $validated['education_form_id'];
$direction->department_id = $validated['department_id'];
$direction->save();
return redirect()->route('directions.index');
}
public function show(Direction $direction): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{
$department = $direction->department;
$faculty = Faculty::find($department->faculty->id);
$educationalInstitution = $faculty->educationalInstitution;
return view(
'admin.catalog.direction.show',
compact(
'direction',
'educationalInstitution',
'faculty',
'department',
)
);
}
public function edit(Direction $direction): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{
$levels = EducationLevel::pluck('name', 'id');
$departments = Department::pluck('name', 'id');
$forms = EducationForm::pluck('name', 'id');
return view('admin.catalog.direction.edit', compact('direction', 'departments', 'levels', 'forms'));
}
public function update(UpdateDirectionRequest $request, Direction $direction): RedirectResponse
{
$validated = $request->validated();
$direction = new Direction();
$direction->name = $validated['name'];
$direction->description = $validated['description'];
$direction->position = $validated['position'];
$direction->slug = $validated['slug'];
$direction->code = $validated['code'];
$direction->education_level_id = $validated['education_level_id'];
$direction->education_form_id = $validated['education_form_id'];
$direction->department_id = $validated['department_id'];
$direction->save();
return redirect()->route('directions.index');
}
public function destroy(Direction $direction): RedirectResponse
{
$direction->delete();
return redirect()->route('directions.index');
}
}

View File

@ -0,0 +1,69 @@
<?php
namespace App\Http\Controllers\admin\Catalog;
use App\Http\Controllers\Controller;
use App\Http\Requests\admin\Catalog\StoreEducationFormRequest;
use App\Http\Requests\admin\Catalog\UpdateEducationFormRequest;
use App\Models\EducationForm;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Illuminate\Foundation\Application;
class EducationFormController extends Controller
{
public function index(): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{
$forms = EducationForm::all();
return view('admin.catalog.education_form.index', compact('forms'));
}
public function create(): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{
return view('admin.catalog.education_form.create');
}
public function store(StoreEducationFormRequest $request)
{
$validated = $request->validated();
$form = new EducationForm();
$form->name = $validated['name'];
$form->description = $validated['description'];
$form->slug = $validated['slug'];
$form->save();
return redirect()->route('education_forms.index');
}
public function show(EducationForm $educationForm): View|Factory|\Illuminate\Contracts\Foundation\Application
{
$directions = $educationForm->directions;
return view('admin.catalog.education_form.show', compact('educationForm', 'directions'));
}
public function edit(EducationForm $educationForm)
{
return view('admin.catalog.education_form.edit', compact('educationForm'));
}
public function update(UpdateEducationFormRequest $request, EducationForm $educationForm)
{
$validated = $request->validated();
$educationForm->name = $validated['name'];
$educationForm->description = $validated['description'];
$educationForm->slug = $validated['slug'];
$educationForm->save();
return redirect()->route('education_forms.index');
}
public function destroy(EducationForm $educationForm)
{
if ($educationForm->directions()->exists()) {
return back();
}
$educationForm->delete();
return redirect()->route('education_forms.index');
}
}

View File

@ -0,0 +1,74 @@
<?php
namespace App\Http\Controllers\admin\Catalog;
use App\Http\Controllers\Controller;
use App\Http\Requests\admin\Catalog\StoreEducationLevelRequest;
use App\Http\Requests\admin\Catalog\UpdateEducationLevelRequest;
use App\Models\EducationLevel;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Illuminate\Foundation\Application;
use Illuminate\Http\RedirectResponse;
class EducationLevelController extends Controller
{
public function index(): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{
$levels = EducationLevel::all();
return view('admin.catalog.education_level.index', compact('levels'));
}
public function create(): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{
return view('admin.catalog.education_level.create');
}
public function store(StoreEducationLevelRequest $request): RedirectResponse
{
$validated = $request->validated();
$level = new EducationLevel();
$level->name = $validated['name'];
$level->description = $validated['description'];
$level->slug = $validated['slug'];
$level->save();
return redirect()->route('education_levels.index');
}
public function show(
EducationLevel $educationLevel
): View|Application|Factory|\Illuminate\Contracts\Foundation\Application {
$directions = $educationLevel->directions();
return view(
'admin.catalog.education_level.show',
compact('educationLevel', 'directions')
);
}
public function edit(EducationLevel $educationLevel)
{
return view('admin.catalog.education_level.edit', compact('educationLevel'));
}
public function update(UpdateEducationLevelRequest $request, EducationLevel $educationLevel): RedirectResponse
{
$validated = $request->validated();
$educationLevel->name = $validated['name'];
$educationLevel->description = $validated['description'];
$educationLevel->slug = $validated['slug'];
$educationLevel->save();
return redirect()->route('education_levels.index');
}
public function destroy(EducationLevel $educationLevel)
{
if ($educationLevel->directions()->exists()) {
return back();
}
$educationLevel->delete();
return redirect()->route('education_levels.index');
}
}

View File

@ -1,9 +1,10 @@
<?php
namespace App\Http\Controllers;
namespace App\Http\Controllers\admin\Catalog;
use App\Http\Requests\StoreEducationalInstitutionRequest;
use App\Http\Requests\UpdateEducationalInstitutionRequest;
use App\Http\Controllers\Controller;
use App\Http\Requests\admin\Catalog\StoreEducationalInstitutionRequest;
use App\Http\Requests\admin\Catalog\UpdateEducationalInstitutionRequest;
use App\Models\EducationalInstitution;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
@ -14,12 +15,12 @@ class EducationalInstitutionController extends Controller
public function index(): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{
$educationalInstitutions = EducationalInstitution::all();
return view('catalog.educational-institution.index', compact('educationalInstitutions'));
return view('admin.catalog.educational_institution.index', compact('educationalInstitutions'));
}
public function create(): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{
return view('catalog.educational-institution.create');
return view('admin.catalog.educational_institution.create');
}
public function store(StoreEducationalInstitutionRequest $request)
@ -29,20 +30,21 @@ class EducationalInstitutionController extends Controller
$educationalInstitution = new EducationalInstitution();
$educationalInstitution->name = $validated['name'];
$educationalInstitution->description = $validated['description'];
$educationalInstitution->slug = $validated['slug'];
$educationalInstitution->position = $validated['position'];
$educationalInstitution->save();
return redirect()->route('educational-institutions.index');
return redirect()->route('educational_institutions.index');
}
public function show(EducationalInstitution $educationalInstitution)
{
return view('catalog.educational-institution.show', compact('educationalInstitution'));
return view('admin.catalog.educational_institution.show', compact('educationalInstitution'));
}
public function edit(EducationalInstitution $educationalInstitution)
{
return view('catalog.educational-institution.edit', compact('educationalInstitution'));
return view('admin.catalog.educational_institution.edit', compact('educationalInstitution'));
}
public function update(UpdateEducationalInstitutionRequest $request, EducationalInstitution $educationalInstitution)
@ -52,9 +54,10 @@ class EducationalInstitutionController extends Controller
$educationalInstitution->name = $validated['name'];
$educationalInstitution->description = $validated['description'];
$educationalInstitution->position = $validated['position'];
$educationalInstitution->slug = $validated['slug'];
$educationalInstitution->save();
return redirect()->route('educational-institutions.index');
return redirect()->route('educational_institutions.index');
}
public function destroy(EducationalInstitution $educationalInstitution)
@ -64,6 +67,6 @@ class EducationalInstitutionController extends Controller
}
$educationalInstitution->delete();
return redirect()->route('educational-institutions.index');
return redirect()->route('educational_institutions.index');
}
}

View File

@ -1,9 +1,10 @@
<?php
namespace App\Http\Controllers;
namespace App\Http\Controllers\admin\Catalog;
use App\Http\Requests\StoreFacultyRequest;
use App\Http\Requests\UpdateFacultyRequest;
use App\Http\Controllers\Controller;
use App\Http\Requests\admin\Catalog\StoreFacultyRequest;
use App\Http\Requests\admin\Catalog\UpdateFacultyRequest;
use App\Models\EducationalInstitution;
use App\Models\Faculty;
use Illuminate\Contracts\View\Factory;
@ -16,13 +17,13 @@ class FacultyController extends Controller
public function index(): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{
$faculties = Faculty::all();
return view('catalog.faculty.index', compact('faculties'));
return view('admin.catalog.faculty.index', compact('faculties'));
}
public function create(): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{
$educationalInstitutions = EducationalInstitution::pluck('name', 'id');
return view('catalog.faculty.create', compact('educationalInstitutions'));
return view('admin.catalog.faculty.create', compact('educationalInstitutions'));
}
public function store(StoreFacultyRequest $request): RedirectResponse
@ -33,16 +34,22 @@ class FacultyController extends Controller
$faculty->name = $validated['name'];
$faculty->description = $validated['description'];
$faculty->position = $validated['position'];
$faculty->slug = $validated['slug'];
$faculty->educational_institution_id = $validated['educational_institution_id'];
$faculty->save();
return redirect()->route('faculties.index');
}
public function show(Faculty $faculty): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{
return view('admin.catalog.faculty.show', compact('faculty'));
}
public function edit(Faculty $faculty): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{
$educationalInstitutions = EducationalInstitution::pluck('name', 'id');
return view('catalog.faculty.edit', compact('faculty', 'educationalInstitutions'));
return view('admin.catalog.faculty.edit', compact('faculty', 'educationalInstitutions'));
}
public function update(UpdateFacultyRequest $request, Faculty $faculty): RedirectResponse
@ -52,6 +59,7 @@ class FacultyController extends Controller
$faculty->name = $validated['name'];
$faculty->description = $validated['description'];
$faculty->position = $validated['position'];
$faculty->slug = $validated['slug'];
$faculty->educational_institution_id = $validated['educational_institution_id'];
$faculty->save();
@ -60,6 +68,9 @@ class FacultyController extends Controller
public function destroy(Faculty $faculty): RedirectResponse
{
if ($faculty->departments()->exists()) {
return back();
}
$faculty->delete();
return redirect()->route('faculties.index');
}

View File

@ -0,0 +1,99 @@
<?php
namespace App\Http\Controllers\admin;
use App\Http\Controllers\Controller;
use App\Http\Requests\admin\StoreDocumentRequest;
use App\Http\Requests\admin\UpdateDocumentRequest;
use App\Models\Admission;
use App\Models\Document;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Illuminate\Foundation\Application;
use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\Storage;
class DocumentController extends Controller
{
public function index(): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{
$documents = Document::all();
return view('admin.documents.index', compact('documents'));
}
public function create(): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{
$admissions = Admission::pluck('name', 'id');
return view('admin.documents.create', compact('admissions'));
}
public function store(StoreDocumentRequest $request): RedirectResponse
{
$this->saveFile($request);
return redirect()->route('documents.index');
}
public function edit(Document $document)
{
$admissions = Admission::pluck('name', 'id');
return view('admin.documents.edit', compact('admissions', 'document'));
}
public function show(Document $document): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{
return view('admin.documents.show', compact('document'));
}
public function update(UpdateDocumentRequest $request, Document $document): RedirectResponse
{
$validated = $request->validated();
$document->name = $validated['name'];
$document->description = $validated['description'];
$document->position = $validated['position'];
$document->admission_id = $validated['admission_id'];
$document->save();
return redirect()->route('documents.index');
}
public function destroy(Document $document)
{
$document->delete();
return redirect()->route('documents.index');
}
public function download($id)
{
$file = (new Document())->find($id);
return Storage::url($file->url);
}
public function createFromAdmission(Admission $admission): View
{
$admissions = Admission::pluck('name', 'id');
$documents = Document::where('admission_id', '=', $admission->id)->get();
return view('admin.documents.create_from_admission', compact('admissions', 'admission', 'documents'));
}
public function storeFromAdmission(StoreDocumentRequest $request): RedirectResponse
{
$this->saveFile($request);
return redirect()->route('admissions.index');
}
private function saveFile(StoreDocumentRequest $request)
{
$fileName = $request->file('document')->getClientOriginalName();
$name = Storage::put('public', $request->file('document'));
$validated = $request->validated();
$document = new Document();
$document->name = $validated['name'];
$document->description = $validated['description'];
$document->file_name = $fileName;
$document->url = Storage::url($name);
$document->position = $validated['position'];
$document->admission_id = $validated['admission_id'];
$document->save();
}
}

View File

@ -1,19 +1,18 @@
<?php
namespace App\Http\Controllers;
namespace App\Http\Controllers\admin;
use App\Models\ReceptionScreen;
use App\Http\Controllers\Controller;
use App\Models\Admission;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Illuminate\Foundation\Application;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class PageController extends Controller
{
public function index(): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{
$receptionScreens = ReceptionScreen::all()->sortBy('position');
return view('menu.reception-screen', compact('receptionScreens'));
$admissions = Admission::all()->sortBy('position');
return view('menu.reception-screen', compact('admissions'));
}
}

View File

@ -1,10 +1,10 @@
<?php
namespace App\Http\Controllers;
namespace App\Http\Controllers\admin;
use App\Http\Requests\UpdateUserRequest;
use App\Http\Controllers\Controller;
use App\Http\Requests\admin\UpdateUserRequest;
use App\Models\User;
use Illuminate\Auth\Events\PasswordReset;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Illuminate\Foundation\Application;
@ -17,14 +17,15 @@ class UserController extends Controller
{
public function __construct()
{
$this->middleware('auth');
$this->authorizeResource(User::class, 'user');
}
public function index(): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{
abort_if(Auth::user()->name !== 'admin', 403);
$users = User::all();
return view('users.index', compact('users'));
return view('admin.users.index', compact('users'));
}
public function store(UpdateUserRequest $request): RedirectResponse
@ -46,14 +47,14 @@ class UserController extends Controller
{
abort_if(Auth::user()->name !== 'admin', 403);
return view('users.create');
return view('admin.users.create');
}
public function edit(User $user): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{
abort_if(Auth::user()->name !== 'admin', 403);
return view('users.edit', compact('user'));
return view('admin.users.edit', compact('user'));
}
public function update(UpdateUserRequest $request, User $user): RedirectResponse

View File

@ -1,29 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
class StoreFacultyRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, ValidationRule|array|string>
*/
public function rules(): array
{
return [
'position' => 'int|max:255',
'name' => 'required|string|max:255|unique:educational_institutions,name',
'description' => 'string',
'educational_institution_id' => 'int'
];
}
}

View File

@ -1,31 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreFileRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'name' => 'max:255',
'position' => 'int|max:255',
'url' => 'file',
'idReceptionScreen' => 'int|max:255',
];
}
}

View File

@ -1,29 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreReceptionScreenRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'name' => 'required|max:255',
'position' => 'required||int|max:255',
];
}
}

View File

@ -1,31 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateFacultyRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'position' => 'int|max:255',
'name' => 'required|string|max:255|unique:educational_institutions,name',
'description' => 'string',
'educational_institution_id' => 'int'
];
}
}

View File

@ -1,30 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateFileRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'name' => 'required|max:255',
'position' => 'required||int|max:255',
'idReceptionScreen' => 'int|max:255',
];
}
}

View File

@ -1,29 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateReceptionScreenRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'name' => 'required|max:255',
'position' => 'required||int|max:255',
];
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace App\Http\Requests\admin\Catalog;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
class StoreDepartmentRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'position' => 'required|int|numeric|max:255',
'name' => 'required|string|max:255|unique:departments,name',
'description' => 'string',
'slug' => 'required|string|max:255',
'faculty_id' => 'required|numeric|int|max:1000',
];
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace App\Http\Requests\admin\Catalog;
use Illuminate\Foundation\Http\FormRequest;
class StoreDirectionRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'position' => 'required|int|numeric|max:255',
'name' => 'required|string|max:255|unique:directions,name',
'description' => 'string',
'slug' => 'required|string|max:255',
'code' => 'required|string|max:255',
'education_level_id' => 'required|int|numeric|max:1000',
'education_form_id' => 'required|int|numeric|max:1000',
'department_id' => 'required|numeric|int|max:1000'
];
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace App\Http\Requests\admin\Catalog;
use Illuminate\Foundation\Http\FormRequest;
class StoreEducationFormRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'name' => 'required|string|max:255|unique:education_levels,name',
'description' => 'string',
'slug' => 'required|string|max:255',
];
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace App\Http\Requests\admin\Catalog;
use Illuminate\Foundation\Http\FormRequest;
class StoreEducationLevelRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'name' => 'required|string|max:255|unique:education_levels,name',
'description' => 'string',
'slug' => 'required|string|max:255',
];
}
}

View File

@ -1,30 +1,23 @@
<?php
namespace App\Http\Requests;
namespace App\Http\Requests\admin\Catalog;
use Illuminate\Foundation\Http\FormRequest;
class StoreEducationalInstitutionRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'position' => 'int|max:255',
'position' => 'required|int|numeric|max:255',
'name' => 'required|string|max:255|unique:educational_institutions,name',
'description' => 'string',
'slug' => 'required|string|max:255',
];
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace App\Http\Requests\admin\Catalog;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
class StoreFacultyRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'position' => 'required|int|numeric|max:255',
'name' => 'required|string|max:255|unique:faculties,name',
'description' => 'string',
'slug' => 'required|string|max:255',
'educational_institution_id' => 'required|int|numeric|max:1000'
];
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Http\Requests\admin\Catalog;
use Illuminate\Foundation\Http\FormRequest;
class UpdateDepartmentRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'position' => 'required|int|numeric|max:255',
'description' => 'string',
'slug' => 'string|required|max:255',
'faculty_id' => 'int|required|numeric|max:255',
'name' => [
'required',
'string',
'max:255',
"unique:departments,name,{$this->department->id}",
],
];
}
}

View File

@ -0,0 +1,33 @@
<?php
namespace App\Http\Requests\admin\Catalog;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
class UpdateDirectionRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'position' => 'required||numeric|int|max:255',
'description' => 'string',
'department_id' => 'int|required|numeric|max:1000',
'slug' => 'required|string|max:255',
'code' => 'required|string|max:255',
'education_level_id' => 'required|int|numeric|max:1000',
'education_form_id' => 'required|int|numeric|max:1000',
'name' => [
'required',
'string',
'max:255',
"unique:directions,name,{$this->direction->id}",
],
];
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace App\Http\Requests\admin\Catalog;
use Illuminate\Foundation\Http\FormRequest;
class UpdateEducationFormRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'name' => "required|string|max:255|unique:education_forms,name,{$this->education_form->id}",
'description' => 'string',
'slug' => 'required|string|max:255',
];
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace App\Http\Requests\admin\Catalog;
use Illuminate\Foundation\Http\FormRequest;
class UpdateEducationLevelRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'name' => "required|string|max:255|unique:education_levels,name,{$this->education_level->id}",
'description' => 'string',
'slug' => 'required|string|max:255',
];
}
}

View File

@ -1,31 +1,23 @@
<?php
namespace App\Http\Requests;
namespace App\Http\Requests\admin\Catalog;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class UpdateEducationalInstitutionRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, ValidationRule|array|string>
*/
public function rules(): array
{
return [
'position' => 'int|max:255',
'position' => 'required|int|numeric|max:255',
'description' => 'string',
'slug' => 'required|string|max:255',
'name' => [
'required',
'string',

View File

@ -0,0 +1,29 @@
<?php
namespace App\Http\Requests\admin\Catalog;
use Illuminate\Foundation\Http\FormRequest;
class UpdateFacultyRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'position' => 'required|int|numeric|max:255',
'description' => 'string',
'slug' => 'required|string|max:255',
'educational_institution_id' => 'required|int|numeric|max:255',
'name' => [
'required',
'string',
'max:255',
"unique:faculties,name,{$this->faculty->id}",
],
];
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace App\Http\Requests\admin;
use Illuminate\Foundation\Http\FormRequest;
class StoreAdmissionRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'position' => 'required|int|numeric|max:255',
'name' => 'required|string|max:255|unique:admissions,name',
'description' => 'string',
'slug' => 'required|string|max:255',
];
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace App\Http\Requests\admin;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
class StoreDocumentRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'name' => 'required|string|max:255',
'description' => 'string',
'position' => 'required|int|numeric|max:255',
'document' => 'required|file',
'admission_id' => 'required|int|numeric|max:1000',
];
}
}

View File

@ -1,31 +1,21 @@
<?php
namespace App\Http\Requests;
namespace App\Http\Requests\admin;
use Illuminate\Foundation\Http\FormRequest;
class StoreUserRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, mixed>
*/
public function rules()
{
return [
'name' => 'required|unique:users,name|max:255',
'email' => 'email',
'email' => 'email|string|max:255',
'password' => 'required'
];
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Http\Requests\admin;
use Illuminate\Foundation\Http\FormRequest;
class UpdateAdmissionRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'position' => 'required|int|numeric|max:255',
'description' => 'string',
'slug' => 'string|required|max:255',
'name' => [
'required',
'string',
'max:255',
"unique:admissions,name,{$this->admission->id}",
],
];
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Http\Requests\admin;
use Illuminate\Foundation\Http\FormRequest;
class UpdateDocumentRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'name' => [
'required',
'string',
'max:255',
"unique:documents,name,{$this->document->id}",
],
'position' => 'required|int|numeric|max:255',
'description' => 'string',
'admission_id' => 'required|int|numeric|max:1000',
];
}
}

View File

@ -1,6 +1,6 @@
<?php
namespace App\Http\Requests;
namespace App\Http\Requests\admin;
use Illuminate\Foundation\Http\FormRequest;
@ -24,9 +24,9 @@ class UpdateUserRequest extends FormRequest
public function rules()
{
return [
'name' => 'required|max:255',
'email' => 'email',
'password' => 'required'
'name' => 'required|string|max:255',
'email' => 'email|string|max:255',
'password' => 'required|max:255'
];
}
}

View File

@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
class ReceptionScreen extends Model
class Admission extends Model
{
use HasFactory;
@ -16,8 +16,8 @@ class ReceptionScreen extends Model
'position'
];
public function files(): HasMany
public function documents(): HasMany
{
return $this->hasMany('App\Models\File', 'reception_screen_id');
return $this->hasMany('App\Models\Document', 'admission_id');
}
}

31
app/Models/Department.php Normal file
View File

@ -0,0 +1,31 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Department extends Model
{
use HasFactory;
protected $fillable = [
'id',
'name',
'slug',
'description',
'position',
];
public function faculty(): BelongsTo
{
return $this->belongsTo(Faculty::class);
}
public function directions(): HasMany
{
return $this->hasMany('App\Models\Direction', 'department_id');
}
}

36
app/Models/Direction.php Normal file
View File

@ -0,0 +1,36 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Direction extends Model
{
use HasFactory;
protected $fillable = [
'id',
'name',
'description',
'position',
'slug',
'code',
];
public function department(): BelongsTo
{
return $this->belongsTo(Department::class);
}
public function educationLevel(): BelongsTo
{
return $this->belongsTo(EducationLevel::class);
}
public function educationForm(): BelongsTo
{
return $this->belongsTo(EducationForm::class);
}
}

View File

@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class File extends Model
class Document extends Model
{
use HasFactory;
@ -18,8 +18,8 @@ class File extends Model
'description',
];
public function receptionScreen(): BelongsTo
public function admission(): BelongsTo
{
return $this->belongsTo(ReceptionScreen::class);
return $this->belongsTo(Admission::class);
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
class EducationForm extends Model
{
use HasFactory;
protected $fillable = [
'id',
'name',
'description',
'slug',
];
public function directions(): HasMany
{
return $this->hasMany('App\Models\Direction', 'education_form_id');
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
class EducationLevel extends Model
{
use HasFactory;
protected $fillable = [
'id',
'name',
'description',
'slug',
];
public function directions(): HasMany
{
return $this->hasMany('App\Models\Direction', 'education_level_id');
}
}

View File

@ -13,6 +13,7 @@ class EducationalInstitution extends Model
protected $fillable = [
'id',
'name',
'slug',
'description',
'position',
];

View File

@ -5,6 +5,7 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Faculty extends Model
{
@ -14,6 +15,7 @@ class Faculty extends Model
'id',
'name',
'description',
'slug',
'position',
];
@ -21,4 +23,9 @@ class Faculty extends Model
{
return $this->belongsTo(EducationalInstitution::class);
}
public function departments(): HasMany
{
return $this->hasMany('App\Models\Department', 'faculty_id');
}
}

View File

@ -1,66 +0,0 @@
<?php
namespace App\Policies;
use App\Models\EducationalInstitution;
use App\Models\User;
use Illuminate\Auth\Access\Response;
class EducationalInstitutionPolicy
{
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
//
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, EducationalInstitution $educationalInstitution): bool
{
//
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
//
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, EducationalInstitution $educationalInstitution): bool
{
//
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, EducationalInstitution $educationalInstitution): bool
{
//
}
/**
* Determine whether the user can restore the model.
*/
public function restore(User $user, EducationalInstitution $educationalInstitution): bool
{
//
}
/**
* Determine whether the user can permanently delete the model.
*/
public function forceDelete(User $user, EducationalInstitution $educationalInstitution): bool
{
//
}
}

View File

@ -1,66 +0,0 @@
<?php
namespace App\Policies;
use App\Models\Faculty;
use App\Models\User;
use Illuminate\Auth\Access\Response;
class FacultyPolicy
{
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
//
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, Faculty $faculty): bool
{
//
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
//
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, Faculty $faculty): bool
{
//
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, Faculty $faculty): bool
{
//
}
/**
* Determine whether the user can restore the model.
*/
public function restore(User $user, Faculty $faculty): bool
{
//
}
/**
* Determine whether the user can permanently delete the model.
*/
public function forceDelete(User $user, Faculty $faculty): bool
{
//
}
}

View File

@ -1,66 +0,0 @@
<?php
namespace App\Policies;
use App\Models\ReceptionScreen;
use App\Models\User;
use Illuminate\Auth\Access\Response;
class ReceptionScreenPolicy
{
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
//
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, ReceptionScreen $doceumentsOnline): bool
{
//
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
//
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, ReceptionScreen $doceumentsOnline): bool
{
//
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, ReceptionScreen $doceumentsOnline): bool
{
//
}
/**
* Determine whether the user can restore the model.
*/
public function restore(User $user, ReceptionScreen $doceumentsOnline): bool
{
//
}
/**
* Determine whether the user can permanently delete the model.
*/
public function forceDelete(User $user, ReceptionScreen $doceumentsOnline): bool
{
//
}
}

View File

@ -0,0 +1,65 @@
<?php
namespace App\Policies;
use App\Models\User;
use Illuminate\Auth\Access\Response;
class UserPolicy
{
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
return $user->name === config('app.admin_name') && $user->email === config('app.admin_email');
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, User $model): bool
{
return $user->name === config('app.admin_name') && $user->email === config('app.admin_email');
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
return $user->name === config('app.admin_name') && $user->email === config('app.admin_email');
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, User $model): bool
{
return $user->name === config('app.admin_name') && $user->email === config('app.admin_email');
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, User $model): bool
{
return $user->name === config('app.admin_name') && $user->email === config('app.admin_email');
}
/**
* Determine whether the user can restore the model.
*/
public function restore(User $user, User $model): bool
{
return $user->name === config('app.admin_name') && $user->email === config('app.admin_email');
}
/**
* Determine whether the user can permanently delete the model.
*/
public function forceDelete(User $user, User $model): bool
{
return $user->name === config('app.admin_name') && $user->email === config('app.admin_email');
}
}

View File

@ -3,6 +3,8 @@
namespace App\Providers;
// use Illuminate\Support\Facades\Gate;
use App\Models\User;
use App\Policies\UserPolicy;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
@ -13,7 +15,7 @@ class AuthServiceProvider extends ServiceProvider
* @var array<class-string, class-string>
*/
protected $policies = [
//
User::class => UserPolicy::class,
];
/**

View File

@ -17,7 +17,7 @@ class RouteServiceProvider extends ServiceProvider
*
* @var string
*/
public const HOME = '/dashboard';
public const HOME = '/admin/dashboard';
/**
* Define your route model bindings, pattern filters, and other route configuration.

View File

@ -4,71 +4,11 @@ namespace App\Services;
use DiDom\Document;
/*
class PageScrapper
{
private string $url;
private string $contentMarker;
public function __construct($url, $contentMarker = '<div class=["\']content_info["\']>')
{
$this->url = $url;
$this->contentMarker = $contentMarker;
}
public function getHTML()
{
$page = file_get_contents($this->url);
$strForPregMatch = "/" . "{$this->contentMarker}" . "(.*)<\/div>/is";
$arr = [];
$rez = preg_match_all($strForPregMatch, $page, $arr);
return $content = $arr[0][0];
}
public function normalizeURLFile($content)
{
$rez = preg_match_all('/<a href="(.*)">/isU', $content, $arr);
$arr[1] = array_unique($arr[1]);
foreach ($arr[1] as $el) {
if (!str_starts_with($el, 'https')) {
$content = str_replace($el, 'https://mkgtu.ru' . $el, $content);
}
}
$rez = preg_match_all('/src="(.*)">/isU', $content, $arr);
$arr[1] = array_unique($arr[1]);
foreach ($arr[1] as $el) {
if (!str_starts_with($el, 'https') && str_contains($el, 'upload')) {
$content = str_replace($el, 'https://mkgtu.ru' . $el, $content);
}
}
return $content;
}
public function cutHTML($content, $strForScissors)
{
$arr = [];
//<footer(.*)<\/footer>
//safdsaf sdfdasf<footer>--------------------------------fsdfdasf <\/footer> asdfdasf asdf
$rez = preg_match_all($strForScissors, $content, $arr);
//$arr[1][0] = '>--------------------------------fsdfdasf ';
$content = str_replace($arr[0], '', $content);
//safdsaf sdfdasf<footer<\/footer> asdfdasf asdf
return $content;
}
}
*/
class PageScrapper
{
private string $url;
private string $contentMarker;
private Document $document;
public function __construct($url, $contentMarker)
{
@ -76,16 +16,19 @@ class PageScrapper
$this->contentMarker = $contentMarker;
$this->document = new Document($this->url, true);
}
public function getFullHTML()
{
return $this->document;
}
public function printHTML()
{
$rez = $this->document;
$content = $rez->first($this->contentMarker)->html();
return $content;
}
public function normalizePath()
{
$rez = $this->document;
@ -114,10 +57,6 @@ class PageScrapper
}
foreach ($srclinks as $k => $srclink) {
$src = $srclink->attr('src');
if (!str_contains($srclink->attr('src'), "https://")) {
@ -126,23 +65,6 @@ class PageScrapper
$html0 = str_replace(urldecode($unchanged), $changed, $html0);
}
}
// foreach ($srclinks as $k => $srclink) {
// $src = $srclink->attr('src');
//
// if (!str_contains($srclink->attr('src'), "https://")) {
//
//
// $tmp = explode('/', rawurldecode($src));
// foreach ( $tmp as $k => $v) {
// $tmp[$k] = rawurlencode($v);
// }
// $src = implode('/', $tmp);
//
//
// $html0 = str_replace($src, 'https://mkgtu.ru' . $src, $html0);
// }
// }
// str_replace('st yle', 'style', $html0);
return $html0;
}

View File

@ -1,29 +0,0 @@
<?php
namespace App\Services;
use Carbon\Carbon;
class WorkWithFiles
{
public static function saveFileToUploads($content)
{
$destinationPath = 'uploads';
$content->move($destinationPath, $content->getClientOriginalName());
}
public static function renameFile($content)
{
$nameChunks = explode('.', $content->getClientOriginalName());
array_splice($nameChunks, 1);
$timestamp = Carbon::now();
$name = implode('.', $nameChunks);
$newName = "{$name}{$timestamp}.{$content->getClientOriginalExtension()}";
$dir = __DIR__;
$path = "{$dir}/../../public/uploads/";
$oldName = $content->getClientOriginalName();
rename("{$path}{$oldName}", "{$path}{$newName}");
return "{$path}{$newName}";
}
}

View File

@ -185,4 +185,6 @@ return [
// 'Example' => App\Facades\Example::class,
])->toArray(),
'admin_name' => env('ADMIN_NAME'),
'admin_email' => env('ADMIN_EMAIL')
];

View File

@ -0,0 +1,18 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class AdmissionFactory extends Factory
{
public function definition(): array
{
return [
'name' => fake()->name(),
'description' => fake()->text(),
'slug' => fake()->slug(),
'position' => fake()->randomDigit(),
];
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class DepartmentFactory extends Factory
{
public function definition(): array
{
return [
'name' => fake()->name(),
'description' => fake()->text(),
'slug' => fake()->slug(),
'position' => fake()->randomDigit(),
'faculty_id' => 1,
];
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class DirectionFactory extends Factory
{
public function definition(): array
{
return [
'name' => fake()->name(),
'description' => fake()->text(),
'slug' => fake()->slug(),
'code' => fake()->text(50),
'position' => fake()->randomDigit(),
'department_id' => 1,
'education_level_id' => 1,
'education_form_id' => 1,
];
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class DocumentFactory extends Factory
{
public function definition(): array
{
return [
'name' => fake()->name(),
'file_name' => fake()->name(),
'description' => fake()->text(),
'url' => fake()->url(),
'position' => fake()->randomDigit(),
'admission_id' => 1,
];
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class EducationFormFactory extends Factory
{
public function definition(): array
{
return [
'name' => fake()->name(),
'description' => fake()->text(),
'slug' => fake()->slug(),
];
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class EducationLevelFactory extends Factory
{
public function definition(): array
{
return [
'name' => fake()->name(),
'description' => fake()->text(),
'slug' => fake()->slug(),
];
}
}

View File

@ -4,20 +4,15 @@ namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\EducationalInstitution>
*/
class EducationalInstitutionFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
'name' => fake()->name(),
'description' => fake()->text(),
'slug' => fake()->slug(),
'position' => fake()->randomDigit(),
];
}
}

View File

@ -4,20 +4,16 @@ namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Faculty>
*/
class FacultyFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
'name' => fake()->name(),
'description' => fake()->text(),
'position' => fake()->randomDigit(),
'slug' => fake()->slug(),
'educational_institution_id' => 1,
];
}
}

View File

@ -1,23 +0,0 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\ReceptionScreen>
*/
class ReceptionScreenFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
];
}
}

View File

@ -6,9 +6,6 @@ use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
@ -22,9 +19,6 @@ return new class extends Migration
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');

View File

@ -6,9 +6,6 @@ use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('password_reset_tokens', function (Blueprint $table) {
@ -18,9 +15,6 @@ return new class extends Migration
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('password_reset_tokens');

View File

@ -6,9 +6,6 @@ use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('failed_jobs', function (Blueprint $table) {
@ -22,9 +19,6 @@ return new class extends Migration
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('failed_jobs');

View File

@ -6,9 +6,6 @@ use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('personal_access_tokens', function (Blueprint $table) {
@ -23,9 +20,6 @@ return new class extends Migration
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('personal_access_tokens');

View File

@ -6,24 +6,20 @@ use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('reception_screens', function (Blueprint $table) {
Schema::create('admissions', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->text('description')->nullable();
$table->string('slug');
$table->integer('position');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('reception_screens');
Schema::dropIfExists('admissions');
}
};

View File

@ -1,33 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('submenu', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('description');
$table->string('parent');
$table->string('meta_title');
$table->string('meta_description');
$table->string('meta_keywords');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('submenu');
}
};

View File

@ -6,28 +6,22 @@ use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('files', function (Blueprint $table) {
Schema::create('documents', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('file_name')->nullable();
$table->string('description')->nullable();
$table->text('description')->nullable();
$table->string('url');
$table->integer('position');
$table->foreignId('reception_screen_id')->constrained('reception_screens');
$table->foreignId('admission_id')->constrained('admissions');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('files');
Schema::dropIfExists('documents');
}
};

View File

@ -6,23 +6,18 @@ use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('educational_institutions', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->text('description');
$table->string('slug');
$table->text('description')->nullable();
$table->integer('position');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('educational_institutions');

View File

@ -6,24 +6,19 @@ use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('faculties', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('description');
$table->text('description')->nullable();
$table->integer('position');
$table->string('slug');
$table->foreignId('educational_institution_id')->constrained('educational_institutions');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('faculties');

View File

@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('departments', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->text('description')->nullable();
$table->integer('position');
$table->string('slug');
$table->foreignId('faculty_id')->constrained('faculties');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('departments');
}
};

View File

@ -0,0 +1,24 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('education_levels', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->text('description')->nullable();
$table->string('slug');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('education_levels');
}
};

View File

@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('directions', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->text('description')->nullable();
$table->string('code');
$table->integer('position');
$table->string('slug');
$table->foreignId('department_id')->constrained('departments');
$table->foreignId('education_level_id')->constrained('education_levels');
$table->foreignId('education_form_id')->constrained('education_forms');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('directions');
}
};

View File

@ -0,0 +1,24 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('education_forms', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->text('description')->nullable();
$table->string('slug');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('education_forms');
}
};

View File

@ -0,0 +1,37 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class AdmissionSeeder extends Seeder
{
public function run(): void
{
DB::table('admissions')->insert([
[
'name' => 'Пункт 1',
'position' => 2,
'description' => 'description 1',
'slug' => 'point-1',
'created_at' => now(),
],
[
'name' => 'Пункт 2',
'position' => 3,
'description' => 'description 2',
'slug' => 'point-2',
'created_at' => now(),
],
[
'name' => 'Пункт 3',
'description' => 'description 3',
'position' => 1,
'slug' => 'point-3',
'created_at' => now(),
]
]);
}
}

View File

@ -2,7 +2,6 @@
namespace Database\Seeders;
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use App\Models\User;
use Illuminate\Database\Seeder;
@ -13,16 +12,26 @@ class DatabaseSeeder extends Seeder
*/
public function run(): void
{
// User::factory(10)->create();
//
User::factory()->create([
'name' => 'admin',
'email' => 'test@example.com',
'password' => 123456
]);
User::factory()->create([
'name' => config('app.admin_name'),
'email' => config('app.admin_email'),
'password' => 123456
]);
User::factory(10)->create();
$this->call([
ReceptionScreenSeeder::class,
FileSeeder::class
EducationalInstitutionSeeder::class,
FacultySeeder::class,
DepartmentSeeder::class,
EducationLevelSeeder::class,
EducationFormSeeder::class,
DirectionSeeder::class,
]);
$this->call([
AdmissionSeeder::class,
DocumentSeeder::class,
]);
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class DepartmentSeeder extends Seeder
{
public function run(): void
{
DB::table('departments')->insert([
[
'name' => 'Кафедра инф. без.',
'description' => 'Кафедра инф. без. описание',
'position' => 1,
'slug' => 'departmentInfWithout',
'faculty_id' => 1,
],
[
'name' => 'кафедра стоматологии',
'description' => 'кафедра стоматологии описание',
'position' => 2,
'slug' => 'departmentOfDentistry',
'faculty_id' => 2,
],
]);
}
}

View File

@ -0,0 +1,46 @@
<?php
namespace Database\Seeders;
use App\Models\Direction;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class DirectionSeeder extends Seeder
{
public function run(): void
{
DB::table('directions')->insert([
[
'name' => 'Юриспруденция',
'description' => 'Юриспруденция',
'slug' => 'jurisprudence',
'code' => '40.03.01',
'position' => 1,
'department_id' => 1,
'education_level_id' => 1,
'education_form_id' => 1,
],
[
'name' => 'фармация',
'description' => 'фармация',
'slug' => 'pharmacy',
'code' => '33.05.01',
'position' => 2,
'department_id' => 1,
'education_level_id' => 2,
'education_form_id' => 2,
],
[
'name' => 'строительство',
'description' => 'строительство',
'slug' => 'construction',
'code' => '08.04.01',
'position' => 3,
'department_id' => 1,
'education_level_id' => 3,
'education_form_id' => 3,
],
]);
}
}

View File

@ -2,42 +2,43 @@
namespace Database\Seeders;
use Carbon\Carbon;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class FileSeeder extends Seeder
class DocumentSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
DB::table('files')->insert([
DB::table('documents')->insert([
[
'name' => 'файл 1',
'file_name' => 'file1',
'description' => 'description1',
'url' => 'url/url1',
'position' => 2,
'reception_screen_id' => 1,
'created_at' => Carbon::now(),
'admission_id' => 1,
'created_at' => now(),
],
[
'name' => 'файл 2',
'description' => 'description2',
'file_name' => 'file2',
'url' => 'url/url2',
'position' => 3,
'reception_screen_id' => 1,
'created_at' => Carbon::now(),
'admission_id' => 1,
'created_at' => now(),
],
[
'name' => 'файл 3',
'file_name' => 'file3',
'description' => 'description3',
'url' => 'url/url3',
'reception_screen_id' => 1,
'admission_id' => 1,
'position' => 1,
'created_at' => Carbon::now(),
'created_at' => now(),
]
]);
}

View File

@ -0,0 +1,31 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class EducationFormSeeder extends Seeder
{
public function run(): void
{
DB::table('education_forms')->insert([
[
'name' => 'очная',
'description' => 'очная',
'slug' => 'full-time',
],
[
'name' => 'заочная',
'description' => 'специалитет',
'slug' => 'part-time',
],
[
'name' => 'очно-заочная',
'description' => 'очно-заочная',
'slug' => 'blended',
],
]);
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class EducationLevelSeeder extends Seeder
{
public function run(): void
{
DB::table('education_levels')->insert([
[
'name' => 'бакалавриат',
'description' => 'бакалавриат',
'slug' => 'baccalaureate',
],
[
'name' => 'специалитет',
'description' => 'специалитет',
'slug' => 'specialty',
],
[
'name' => 'магитсратура',
'description' => 'магитсратура',
'slug' => 'magistracy',
],
]);
}
}

View File

@ -2,8 +2,10 @@
namespace Database\Seeders;
use App\Models\EducationalInstitution;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class EducationalInstitutionSeeder extends Seeder
{
@ -12,6 +14,19 @@ class EducationalInstitutionSeeder extends Seeder
*/
public function run(): void
{
//
DB::table('educational_institutions')->insert([
[
'name' => 'МГТУ',
'description' => 'ФГБОУ ВО Майкопский государственный технологический университет',
'slug' => 'mkgtu',
'position' => 1,
],
[
'name' => 'Педколледж',
'description' => 'ФГБОУ СПО Педагогический колледж',
'slug' => 'pedcollege',
'position' => 1,
],
]);
}
}

View File

@ -2,8 +2,10 @@
namespace Database\Seeders;
use App\Models\Faculty;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class FacultySeeder extends Seeder
{
@ -12,6 +14,22 @@ class FacultySeeder extends Seeder
*/
public function run(): void
{
//
// Faculty::factory(3)->create();
DB::table('faculties')->insert([
[
'name' => 'Информационная безопасность',
'description' => 'Факультет информационной безопасности описание',
'position' => 1,
'slug' => 'new-slug-inf',
'educational_institution_id' => 1,
],
[
'name' => 'Лечебный факультет',
'description' => 'Факультет Лечебный описание',
'position' => 1,
'slug' => 'new-slug-med',
'educational_institution_id' => 2,
],
]);
}
}

View File

@ -1,35 +0,0 @@
<?php
namespace Database\Seeders;
use Carbon\Carbon;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class ReceptionScreenSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
DB::table('reception_screens')->insert([
[
'name' => 'Пункт 1 с файлами',
'position' => 2,
'created_at' => Carbon::now(),
],
[
'name' => 'Пункт 2 с файлами',
'position' => 3,
'created_at' => Carbon::now(),
],
[
'name' => 'Пункт 3 с файлами',
'position' => 1,
'created_at' => Carbon::now(),
]
]);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 MiB

View File

@ -1,32 +0,0 @@
#-------------------------------------------------------------------------------#
# Qodana analysis is configured by qodana.yaml file #
# https://www.jetbrains.com/help/qodana/qodana-yaml.html #
#-------------------------------------------------------------------------------#
version: "1.0"
#Specify inspection profile for code analysis
profile:
name: qodana.starter
#Enable inspections
#include:
# - name: <SomeEnabledInspectionId>
#Disable inspections
#exclude:
# - name: <SomeDisabledInspectionId>
# paths:
# - <path/where/not/run/inspection>
php:
version: 8.3 #(Applied in CI/CD pipeline)
#Execute shell command before Qodana execution (Applied in CI/CD pipeline)
#bootstrap: sh ./prepare-qodana.sh
#Install IDE plugins before Qodana execution (Applied in CI/CD pipeline)
#plugins:
# - id: <plugin.id> #(plugin id can be found at https://plugins.jetbrains.com)
#Specify Qodana linter for analysis (Applied in CI/CD pipeline)
linter: jetbrains/qodana-php:latest

View File

@ -1,4 +1,4 @@
import './bootstrap';
// import './bootstrap';
import Alpine from 'alpinejs';
import ujs from '@rails/ujs';

View File

@ -1,60 +0,0 @@
@extends('layouts.admin-layout')
@section('content')
@auth()
<div class="row">
<div class="col">
<h1 class=""> Изменить пункт Экрана приема</h1>
{{ Form::open(['url' => route('admin-reception-screen.update', $currentReceptionScreen), 'method' => 'PATCH', 'class' => '']) }}
<div class="col">
<div>
{{ Form::label('position', 'Позиция') }}
</div>
<div class="mt-2">
{{ Form::text('position', $currentReceptionScreen->position, ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('position') }}
@endif
</div>
<div>
{{ Form::label('name', 'Название') }}
</div>
<div class="mt-2">
{{ Form::text('name', $currentReceptionScreen->name, ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('name') }}
@endif
</div>
<div class="mt-4">
{{ Form::submit('Изменить', ['class' => 'btn btn-primary']) }}
</div>
</div>
{{ Form::close() }}
</div>
<div class="col">
<table class="table">
<thead class="border-b-2 border-solid border-black text-left" style="text-align: left">
<tr>
<th scope="col">Позиция</th>
<th scope="col">Название</th>
</tr>
</thead>
<tbody>
@foreach($receptionScreens as $receptionScreen)
<tr>
<th scope="row">{{ $receptionScreen->position }}</th>
<td>{{ $receptionScreen->name }}</td>
@endforeach
</tbody>
</table>
</div>
</div>
@endauth
@endsection

View File

@ -1,144 +0,0 @@
@extends('layouts.admin-layout')
@section('content')
<style>
.accordion-button:not(.collapsed)
{
color:#006147;
background-color: rgb(255, 255, 255);
box-shadow:inset 0 -1px 0 rgba(0,0,0,.125)
}
.accordion-button:focus {
z-index: 3;
border-color: #006147;
outline: 0;
box-shadow: 0 0 0 0.25rem #006147;
}
</style>
<div class="container">
<h2>Экран Приема</h2>
<br>
<a href="{{ route('admin-reception-screen.create') }}" class="btn btn-primary">Создать пункт Экрана приема</a>
<br>
<br>
<table class="table">
<thead class="border-b-2 border-solid border-black text-left" style="text-align: left">
<tr>
<th scope="col">Позиция</th>
<th scope="col">Название</th>
<th scope="col">действия</th>
<th scope="col"></th>
</tr>
</thead>
<tbody class="accordion" id="accordionExample">
@foreach($receptionScreens as $receptionScreen)
<?php $accordion_tmp = str_replace(' ','', $receptionScreen->name) ?>
<tr class="accordion-item ">
<th scope="row">{{ $receptionScreen->position }}</th>
<td>{{ $receptionScreen->name }}</td>
<td><a href="{{ route("admin-reception-screen.edit", $receptionScreen) }}" class="btn btn-secondary">редактировать</a>
<a rel="nofollow" data-method="delete" data-confirm="Вы действительно хотите удалить?"
href="{{ route('admin-reception-screen.destroy', $receptionScreen) }}" class="btn btn-danger">
удалить
</a>
</td>
<th class="accordion-header" id="heading<?php echo $accordion_tmp ?>">
<button class="accordion-button collapsed btn btn-secondary" type="button" data-bs-toggle="collapse" data-bs-target="#collapse<?php echo $accordion_tmp ?> " aria-expanded="false" aria-controls="collapse<?php echo $accordion_tmp ?>">
Показать
</button>
</th>
@if(count($receptionScreen->files) !== 0)
</tr>
<tr>
<td colspan="3">
<table class="table table-bordered accordion-collapse collapse" id="collapse<?php echo $accordion_tmp ?>" aria-labelledby="heading<?php echo $accordion_tmp ?>" data-bs-parent="#accordionExample">
<thead class="accordion-body">
<tr>
<th scope="col">Позиция</th>
<th scope="col">Имя Файла</th>
<th scope="col">действия</th>
</tr>
</thead>
<tbody>
@foreach($receptionScreen->files->sortBy('position') as $file)
<tr>
<th scope="row">{{ $file->position }}</th>
<td>{{ $file->name }}</td>
<td><a href="{{ route("files.edit", $file) }}"
class="btn btn-secondary">редактировать</a>
<a rel="nofollow" data-method="delete"
data-confirm="Вы действительно хотите удалить?"
href="{{ route('files.destroy', $file) }}"
class="btn btn-danger">
удалить
</a>
</td>
</tr>
@endforeach
<tr class=" border border-white border-bottom-0 border-start-0 border-end-0">
<td colspan="3"><div class="mb-2">
<a href="{{ route('files.create', $receptionScreen->id) }}"
class="btn btn-primary">
Добавить файл
</a>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
@else
<tr>
<td colspan="3">
@php($idReceptionScreen = $receptionScreen->id)
<a href="{{ route('files.create', $idReceptionScreen) }}" class="btn btn-primary">Добавить
файл</a>
</td>
</tr>
@endif
@endforeach
</tbody>
</table>
<br>
<br>
</div>
@endsection

View File

@ -1,4 +1,4 @@
@extends('layouts.admin-layout')
@extends('layouts.admin_layout')
@section('content')

View File

@ -1,11 +1,11 @@
@extends('layouts.admin-layout')
@extends('layouts.admin_layout')
@section('content')
@auth()
<div class="row">
<div class="col">
<h1 class=""> Создать пункт Экрана приема</h1>
{{ Form::open(['url' => route('admin-reception-screen.store'), 'method' => 'POST', 'class' => '']) }}
{{ Form::open(['url' => route('admissions.store'), 'method' => 'POST', 'class' => '']) }}
<div class="col">
<div>
{{ Form::label('position', 'Позиция') }}
@ -31,6 +31,30 @@
@endif
</div>
<div>
{{ Form::label('description', 'Описание') }}
</div>
<div class="mt-2">
{{ Form::text('description', '', ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('description') }}
@endif
</div>
<div>
{{ Form::label('slug', 'URL') }}
</div>
<div class="mt-2">
{{ Form::text('slug', '', ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('description') }}
@endif
</div>
<div class="mt-4">
{{ Form::submit('создать', ['class' => 'btn btn-primary']) }}
</div>
@ -46,10 +70,10 @@
</tr>
</thead>
<tbody>
@foreach($receptionScreens as $receptionScreen)
@foreach($admissions->sortBy('position') as $admission)
<tr>
<th scope="row">{{ $receptionScreen->position }}</th>
<td>{{ $receptionScreen->name }}</td>
<th scope="row">{{ $admission->position }}</th>
<td>{{ $admission->name }}</td>
@endforeach
</tbody>
</table>

View File

@ -0,0 +1,66 @@
@extends('layouts.admin_layout')
@section('content')
@auth()
<div class="row">
<div class="col">
<h1 class=""> Изменить пункт меню Экрана приема</h1>
{{ Form::open(['url' => route('admissions.update', $admission), 'method' => 'PATCH', 'class' => '']) }}
<div class="col">
<div>
{{ Form::label('position', 'Позиция') }}
</div>
<div class="mt-2">
{{ Form::text('position', $admission->position, ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('position') }}
@endif
</div>
<div>
{{ Form::label('name', 'Название') }}
</div>
<div class="mt-2">
{{ Form::text('name', $admission->name, ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('name') }}
@endif
</div>
<div>
{{ Form::label('description', 'Описание') }}
</div>
<div class="mt-2">
{{ Form::text('description', $admission->description, ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('description') }}
@endif
</div>
<div>
{{ Form::label('slug', 'URL') }}
</div>
<div class="mt-2">
{{ Form::text('slug', $admission->slug, ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('description') }}
@endif
</div>
<div class="mt-4">
{{ Form::submit('Изменить', ['class' => 'btn btn-primary']) }}
</div>
</div>
{{ Form::close() }}
</div>
</div>
@endauth
@endsection

View File

@ -0,0 +1,109 @@
@extends('layouts.admin_layout')
@section('content')
<div class="container">
<h2>Меню экрана приема</h2>
<br>
<a href="{{ route('admissions.create') }}" class="btn btn-primary">Добавить меню экрана приема</a>
<br>
<br>
<table class="table">
<thead class="border-b-2 border-solid border-black text-left" style="text-align: left">
<tr>
<th scope="col">Позиция</th>
<th scope="col">Название</th>
<th scope="col">действия</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
@foreach($admissions as $admission)
<tr class="">
<th scope="row">{{ $admission->position }}</th>
<td><a href="{{ route('admissions.show', $admission) }}">{{ $admission->name }}
@if(count($admission->documents) !== 0)
({{ count($admission->documents) }} файла)
@endif</a></td>
<td>
<a href="{{ route("admissions.edit", $admission) }}"
class="btn btn-secondary">редактировать</a>
<a rel="nofollow" data-method="delete" data-confirm="Вы действительно хотите удалить?"
href="{{ route('admissions.destroy', $admission) }}"
class="btn btn-danger">удалить</a>
</td>
@if(count($admission->documents) !== 0)
<td>
<button class="btn btn-primary" type="button" data-bs-toggle="collapse"
data-bs-target="#collapseAdmission{{ $admission->id }}" aria-expanded="false"
aria-controls="collapseAdmission{{ $admission->id }}">
Свернуть
</button>
</td>
</tr>
<tr>
<td colspan="3">
<div class="collapse" id="collapseAdmission{{ $admission->id }}">
<table class="table table-bordered">
<thead>
<tr>
<th scope="col">Позиция</th>
<th scope="col">Имя Файла</th>
<th scope="col">действия</th>
</tr>
</thead>
<tbody>
@foreach($admission->documents as $document)
<tr>
<th scope="row">{{ $document->position }}</th>
<td>{{ $document->name }}</td>
<td><a href="{{ route("documents.edit", $document) }}"
class="btn btn-secondary">редактировать</a>
<a rel="nofollow" data-method="delete"
data-confirm="Вы действительно хотите удалить?"
href="{{ route('documents.destroy', $document) }}"
class="btn btn-danger">
удалить
</a>
</td>
</tr>
@endforeach
<tr class=" border border-white border-bottom-0 border-start-0 border-end-0">
<td colspan="4">
<div class="mb-2">
<a href="{{ route('document_create_from_admission', $admission) }}"
class="btn btn-primary">
Добавить файл
</a>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</td>
<td></td>
</tr>
@else
<td><a class="btn btn-secondary disabled" href=""
role="button">
Сверунть
</a></td>
<tr>
<td colspan="4">
<a href="{{ route('document_create_from_admission', $admission) }}"
class="btn btn-primary">Добавить
файл</a>
</td>
</tr>
@endif
@endforeach
</tbody>
</table>
<br>
<br>
</div>
@endsection

View File

@ -0,0 +1,19 @@
@extends('layouts.admin_layout')
@section('content')
@auth()
<div class="container mt-4">
<h2>Название</h2>
<p>{{ $admission->name }}</p>
<h2>Описание</h2>
<p>{{ $admission->description }}</p>
<h2>Позиция</h2>
<p>{{ $admission->position }}</p>
<h2>URL</h2>
<p>{{ $admission->slug }}</p>
<h2>Документы</h2>
@foreach($admission->documents as $document)
<p><a href="{{ route('documents.show', $document) }}">{{ $document->name }}</a></p>
@endforeach
</div>
@endauth
@endsection

Some files were not shown because too many files have changed in this diff Show More