Compare commits

..

10 Commits

39 changed files with 1414 additions and 410 deletions

View File

@ -9,59 +9,59 @@ on:
- main - main
jobs: jobs:
# build: build:
# runs-on: ubuntu-latest runs-on: ubuntu-latest
#
# strategy: strategy:
# matrix: matrix:
# php-versions: [ '8.3' ] php-versions: [ '8.3' ]
# node-version: ['20.x'] node-version: ['20.x']
#
# steps: steps:
# - uses: actions/checkout@v4 - uses: actions/checkout@v4
#
# - name: Set up PHP ${{ matrix.php-versions }} - name: Set up PHP ${{ matrix.php-versions }}
# uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
# with: with:
# php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
#
# - name: PHP Security Checker - name: PHP Security Checker
# uses: StephaneBour/actions-php-security-checker@1.1 uses: StephaneBour/actions-php-security-checker@1.1
#
# - name: Use Node.js ${{ matrix.node-version }} - name: Use Node.js ${{ matrix.node-version }}
# uses: actions/setup-node@v3 uses: actions/setup-node@v3
# with: with:
# node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
#
# - name: Add keys - name: Add keys
# run: | run: |
# sudo curl -o ~/.composer/keys.tags.pub -sL https://composer.github.io/releases.pub 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 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 $COMPOSER_AUTH|jq -r '.["github-oauth"]["github.com"]'|base64
# - run: echo $GITHUB_TOKEN|base64 - run: echo $GITHUB_TOKEN|base64
# - name: Diagnose composer - name: Diagnose composer
# env: env:
# COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH_JSON }} # only this works COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH_JSON }} # only this works
# run: composer diagnose -vvv run: composer diagnose -vvv
# - name: Install dependencies - name: Install dependencies
# env: env:
# COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH_JSON }} # only this works COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH_JSON }} # only this works
# run: composer install # will work run: composer install # will work
#
# - name: Setup sqlite3 driver - name: Setup sqlite3 driver
# run: apt install php${{ matrix.php-versions }}-sqlite3 -y run: apt install php${{ matrix.php-versions }}-sqlite3 -y
#
# - name: Setup project - name: Setup project
# run: make setup run: make setup
#
# - name: Check lint - name: Check lint
# run: make lint run: make lint
#
# - name: Check tests - name: Check tests
# run: make test run: make test
deploy: deploy:
# needs: build needs: build
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
@ -74,5 +74,6 @@ jobs:
port: ${{ secrets.PORT }} port: ${{ secrets.PORT }}
script: | script: |
cd /var/www/test-testabit/ cd /var/www/test-testabit/
git fetch git stash
git pull --rebase
make setup-test make setup-test

View File

@ -9,7 +9,7 @@ setup:
cp -n .env.example .env cp -n .env.example .env
php artisan key:gen --ansi php artisan key:gen --ansi
touch database/database.sqlite touch database/database.sqlite
php artisan migrate php artisan migrate:refresh
php artisan db:seed php artisan db:seed
npm ci npm ci
npm run build npm run build

View File

@ -0,0 +1,69 @@
<?php
namespace App\Http\Controllers;
use App\Http\Requests\StoreEducationalInstitutionRequest;
use App\Http\Requests\UpdateEducationalInstitutionRequest;
use App\Models\EducationalInstitution;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Illuminate\Foundation\Application;
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'));
}
public function create(): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{
return view('catalog.educational-institution.create');
}
public function store(StoreEducationalInstitutionRequest $request)
{
$validated = $request->validated();
$educationalInstitution = new EducationalInstitution();
$educationalInstitution->name = $validated['name'];
$educationalInstitution->description = $validated['description'];
$educationalInstitution->position = $validated['position'];
$educationalInstitution->save();
return redirect()->route('educational-institutions.index');
}
public function show(EducationalInstitution $educationalInstitution)
{
return view('catalog.educational-institution.show', compact('educationalInstitution'));
}
public function edit(EducationalInstitution $educationalInstitution)
{
return view('catalog.educational-institution.edit', compact('educationalInstitution'));
}
public function update(UpdateEducationalInstitutionRequest $request, EducationalInstitution $educationalInstitution)
{
$validated = $request->validated();
$educationalInstitution->name = $validated['name'];
$educationalInstitution->description = $validated['description'];
$educationalInstitution->position = $validated['position'];
$educationalInstitution->save();
return redirect()->route('educational-institutions.index');
}
public function destroy(EducationalInstitution $educationalInstitution)
{
if ($educationalInstitution->faculties()->exists()) {
return back();
}
$educationalInstitution->delete();
return redirect()->route('educational-institutions.index');
}
}

View File

@ -0,0 +1,66 @@
<?php
namespace App\Http\Controllers;
use App\Http\Requests\StoreFacultyRequest;
use App\Http\Requests\UpdateFacultyRequest;
use App\Models\EducationalInstitution;
use App\Models\Faculty;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Illuminate\Foundation\Application;
use Illuminate\Http\RedirectResponse;
class FacultyController extends Controller
{
public function index(): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{
$faculties = Faculty::all();
return view('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'));
}
public function store(StoreFacultyRequest $request): RedirectResponse
{
$validated = $request->validated();
$faculty = new Faculty();
$faculty->name = $validated['name'];
$faculty->description = $validated['description'];
$faculty->position = $validated['position'];
$faculty->educational_institution_id = $validated['educational_institution_id'];
$faculty->save();
return redirect()->route('faculties.index');
}
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'));
}
public function update(UpdateFacultyRequest $request, Faculty $faculty): RedirectResponse
{
$validated = $request->validated();
$faculty->name = $validated['name'];
$faculty->description = $validated['description'];
$faculty->position = $validated['position'];
$faculty->educational_institution_id = $validated['educational_institution_id'];
$faculty->save();
return redirect()->route('faculties.index');
}
public function destroy(Faculty $faculty): RedirectResponse
{
$faculty->delete();
return redirect()->route('faculties.index');
}
}

View File

@ -35,9 +35,8 @@ class FileController extends Controller
abort_if(Auth::guest(), 403); abort_if(Auth::guest(), 403);
$receptionScreens = ReceptionScreen::pluck('name', 'id'); $receptionScreens = ReceptionScreen::pluck('name', 'id');
$idsReceptionScreens = $receptionScreens->keys()->toArray();
$files = File::where('reception_screen_id', '=', $idReceptionScreen)->get(); $files = File::where('reception_screen_id', '=', $idReceptionScreen)->get();
return view('files.create', compact('receptionScreens', 'idsReceptionScreens', 'idReceptionScreen', 'files')); return view('files.create', compact('receptionScreens', 'idReceptionScreen', 'files'));
} }
public function store(StoreFileRequest $request) public function store(StoreFileRequest $request)

View File

@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests;
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',
'name' => 'required|string|max:255|unique:educational_institutions,name',
'description' => 'string',
];
}
}

View File

@ -0,0 +1,29 @@
<?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

@ -0,0 +1,37 @@
<?php
namespace App\Http\Requests;
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',
'description' => 'string',
'name' => [
'required',
'string',
'max:255',
"unique:educational_institutions,name,{$this->educational_institution->id}",
],
];
}
}

View File

@ -0,0 +1,31 @@
<?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

@ -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 EducationalInstitution extends Model
{
use HasFactory;
protected $fillable = [
'id',
'name',
'description',
'position',
];
public function faculties(): HasMany
{
return $this->hasMany('App\Models\Faculty', 'educational_institution_id');
}
}

24
app/Models/Faculty.php Normal file
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\BelongsTo;
class Faculty extends Model
{
use HasFactory;
protected $fillable = [
'id',
'name',
'description',
'position',
];
public function educationalInstitution(): BelongsTo
{
return $this->belongsTo(EducationalInstitution::class);
}
}

View File

@ -13,6 +13,7 @@ class File extends Model
protected $fillable = [ protected $fillable = [
'id', 'id',
'name', 'name',
'file_name',
'url', 'url',
'description', 'description',
]; ];

View File

@ -0,0 +1,66 @@
<?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

@ -0,0 +1,66 @@
<?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

@ -0,0 +1,23 @@
<?php
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 [
//
];
}
}

View File

@ -0,0 +1,23 @@
<?php
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 [
//
];
}
}

View File

@ -14,6 +14,7 @@ return new class extends Migration
Schema::create('files', function (Blueprint $table) { Schema::create('files', function (Blueprint $table) {
$table->id(); $table->id();
$table->string('name'); $table->string('name');
$table->string('file_name')->nullable();
$table->string('description')->nullable(); $table->string('description')->nullable();
$table->string('url'); $table->string('url');
$table->integer('position'); $table->integer('position');

View File

@ -0,0 +1,30 @@
<?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('educational_institutions', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->text('description');
$table->integer('position');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('educational_institutions');
}
};

View File

@ -0,0 +1,31 @@
<?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('faculties', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('description');
$table->integer('position');
$table->foreignId('educational_institution_id')->constrained('educational_institutions');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('faculties');
}
};

View File

@ -13,8 +13,8 @@ class DatabaseSeeder extends Seeder
*/ */
public function run(): void public function run(): void
{ {
User::factory(10)->create(); // User::factory(10)->create();
//
User::factory()->create([ User::factory()->create([
'name' => 'admin', 'name' => 'admin',
'email' => 'test@example.com', 'email' => 'test@example.com',

View File

@ -0,0 +1,17 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class EducationalInstitutionSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class FacultySeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 KiB

32
qodana.yaml Normal file
View File

@ -0,0 +1,32 @@
#-------------------------------------------------------------------------------#
# 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

@ -0,0 +1,53 @@
@extends('layouts.admin-layout')
@section('content')
@auth()
<div class="row">
<div class="col">
<h1 class=""> Создать учебное заведение</h1>
{{ Form::open(['url' => route('educational-institutions.store'), 'method' => 'POST', 'class' => '']) }}
<div class="col">
<div>
{{ Form::label('position', 'Позиция') }}
</div>
<div class="mt-2">
{{ Form::text('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', '', ['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', '', ['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,53 @@
@extends('layouts.admin-layout')
@section('content')
@auth()
<div class="row">
<div class="col">
<h1 class="">Изменить учебное заведение</h1>
{{ Form::model($educationalInstitution, ['route' => ['educational-institutions.update', $educationalInstitution], 'method' => 'PATCH', 'class' => '']) }}
<div class="col">
<div>
{{ Form::label('position', 'Позиция') }}
</div>
<div class="mt-2">
{{ Form::text('position', $educationalInstitution->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', $educationalInstitution->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', $educationalInstitution->description, ['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,42 @@
@extends('layouts.admin-layout')
@section('content')
<div class="container">
<h2>Учебные заведения</h2>
<br>
<a href="{{ route('educational-institutions.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>
<th scope="col"></th>
</tr>
</thead>
<tbody class="accordion" id="accordionExample">
@foreach($educationalInstitutions as $educationalInstitution)
<tr class="">
<th scope="row">{{ $educationalInstitution->position }}</th>
<td><a href="{{ route('educational-institutions.show', $educationalInstitution) }}">{{ $educationalInstitution->name }}</a></td>
<td>{{ Str::words($educationalInstitution->description, 10, '...') }}</td>
<td class="col-3"><a href="{{ route("educational-institutions.edit", $educationalInstitution) }}"
class="btn btn-secondary">редактировать</a>
<a rel="nofollow" data-method="delete" data-confirm="Вы действительно хотите удалить?"
href="{{ route('educational-institutions.destroy', $educationalInstitution) }}"
class="btn btn-danger">
удалить
</a>
</td>
</tr>
@endforeach
</tbody>
</table>
<br>
<br>
</div>
@endsection

View File

@ -0,0 +1,18 @@
@extends('layouts.admin-layout')
@section('content')
@auth()
<div class="container mt-4">
<h2>Название</h2>
<p>{{ $educationalInstitution->name }}</p>
<h2>Описание</h2>
<p>{{ $educationalInstitution->description }}</p>
<h2>Позиция</h2>
<p>{{ $educationalInstitution->position }}</p>
<h2>Факультеты</h2>
@foreach($educationalInstitution->faculties as $faculty)
<p><a href="{{ route('faculties.show', $faculty) }}">{{ $faculty->name }}</a></p>
@endforeach
</div>
@endauth
@endsection

View File

@ -0,0 +1,64 @@
@extends('layouts.admin-layout')
@section('content')
@auth()
<div class="row">
<div class="col">
<h1 class=""> Создать факультет</h1>
{{ Form::open(['url' => route('faculties.store'), 'method' => 'POST', 'class' => '']) }}
<div class="col">
<div class="mt-3">
{{ Form::label('position', 'Позиция') }}
</div>
<div class="mt-1">
{{ Form::text('position', '', ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('position') }}
@endif
</div>
<div class="mt-3">
{{ Form::label('name', 'Название') }}
</div>
<div class="mt-1">
{{ Form::text('name', '', ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('name') }}
@endif
</div>
<div class="mt-3">
{{ Form::label('description', 'Описание') }}
</div>
<div class="mt-1">
{{ Form::text('description', '', ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('description') }}
@endif
</div>
<div class="mt-3">
{{ Form::label('educational_institution_id', 'Учебное заведение') }}
</div>
<div class="mt-1">
{{ Form::select('educational_institution_id', $educationalInstitutions, null, ['class' => 'form-select']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('educational_institution_id') }}
@endif
</div>
<div class="mt-3">
{{ Form::submit('создать', ['class' => 'btn btn-primary']) }}
</div>
</div>
{{ Form::close() }}
</div>
</div>
@endauth
@endsection

View File

@ -0,0 +1,64 @@
@extends('layouts.admin-layout')
@section('content')
@auth()
<div class="row">
<div class="col">
<h1 class=""> Создать факультет</h1>
{{ Form::open(['url' => route('faculties.update', $faculty), 'method' => 'PATCH', 'class' => '']) }}
<div class="col">
<div class="mt-3">
{{ Form::label('position', 'Позиция') }}
</div>
<div class="mt-1">
{{ Form::text('position', $faculty->position, ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('position') }}
@endif
</div>
<div class="mt-3">
{{ Form::label('name', 'Название') }}
</div>
<div class="mt-1">
{{ Form::text('name', $faculty->name, ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('name') }}
@endif
</div>
<div class="mt-3">
{{ Form::label('description', 'Описание') }}
</div>
<div class="mt-1">
{{ Form::text('description', $faculty->description, ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('description') }}
@endif
</div>
<div class="mt-3">
{{ Form::label('educational_institution_id', 'Учебное заведение') }}
</div>
<div class="mt-1">
{{ Form::select('educational_institution_id', $educationalInstitutions, $faculty->educationalInstitution->id, ['class' => 'form-select']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('educational_institution_id') }}
@endif
</div>
<div class="mt-3">
{{ Form::submit('создать', ['class' => 'btn btn-primary']) }}
</div>
</div>
{{ Form::close() }}
</div>
</div>
@endauth
@endsection

View File

@ -0,0 +1,44 @@
@extends('layouts.admin-layout')
@section('content')
<div class="container">
<h2>Факультеты</h2>
<br>
<a href="{{ route('faculties.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>
<th scope="col">действия</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
@foreach($faculties as $faculty)
<tr class="">
<th scope="row">{{ $faculty->position }}</th>
<td>{{ $faculty->name }}</td>
<td>{{ $faculty->description }}</td>
<td>{{ $faculty->educationalInstitution->name }}</td>
<td><a href="{{ route("faculties.edit", $faculty) }}"
class="btn btn-secondary">редактировать</a>
<a rel="nofollow" data-method="delete" data-confirm="Вы действительно хотите удалить?"
href="{{ route('faculties.destroy', $faculty) }}"
class="btn btn-danger">
удалить
</a>
</td>
</tr>
@endforeach
</tbody>
</table>
<br>
<br>
</div>
@endsection

View File

@ -42,7 +42,7 @@
{{ Form::label('idReceptionScreen', 'Пункт экрана приема') }} {{ Form::label('idReceptionScreen', 'Пункт экрана приема') }}
</div> </div>
<div class="mt-2"> <div class="mt-2">
{{ Form::select('idReceptionScreen', $receptionScreens, $idReceptionScreen, $idsReceptionScreens,['class' => 'form-select']) }} {{ Form::select('idReceptionScreen', $receptionScreens, $idReceptionScreen, ['class' => 'form-select']) }}
</div> </div>
<div> <div>
@if ($errors->any()) @if ($errors->any())

View File

@ -1,10 +1,52 @@
@extends('layouts.applicant-layout') @extends('layouts.applicant-layout')
@section('content') @section('content')
<style>
.gradient{
background: linear-gradient(to bottom right, #006147, 70%, #b4ffdf);
}
</style>
<main> <main>
<div class="gradient" style="margin-top: 100px;" >
<div class="mx-4 py-4">
<div class="row row-cols-3">
<div class="col-4 d-flex justify-content-center align-items-center ">
<div class="row">
<h1 class="text-white"> Факультеты </h1>
</div>
</div>
<div class="col-4">
<div class="row rounded-3 d-flex justify-content-center align-items-center mx-3 my-4" style="background-image: url({{ URL::to('img/front-page/gdpr-technology-1440x786.jpg') }});">
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<h2 class="text-center text-white"> Технологический факультет </h2>
</div>
<div class="row rounded-3 d-flex justify-content-center align-items-center mx-3 my-4" style="background-image: url({{ URL::to('img/front-page/gdpr-technology-1440x786.jpg') }});">
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<h2 class="text-center text-white"> Технологический факультет </h2>
</div>
</div>
<div class="col-4 ">
<br><br><br><br><br><br>
<div class="row rounded-3 d-flex justify-content-center align-items-center mx-3 " style="background-image: url({{ URL::to('img/front-page/AQAGJDJMWkDLsAm2TwULzZaDAdMYqCMnNFWgL57t5CgxbY-O2mPVKs_jAFZ05sj7uxTzt4G8f-hkB_GlgSz-53wJA58.jpg') }});">
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<h2 class="text-center text-white"> Факультет экономики и управления </h2>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- service area start --> <!-- service area start -->
<div class="tp-feature__section pt-120 pb-30"> <div class="tp-feature__section pt-120 pb-30 ">
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
@ -131,6 +173,7 @@
} }
</style> </style>
<div class="mt-4">
<div class="text-center my-5"> <div class="text-center my-5">
<h1 class="text-dark"> Программы обучения в МГТУ</h1> <h1 class="text-dark"> Программы обучения в МГТУ</h1>
<h3>Тут можно узнать какие программы обучения есть в нашем ВУЗе.</h3> <h3>Тут можно узнать какие программы обучения есть в нашем ВУЗе.</h3>
@ -286,7 +329,7 @@
</div> </div>
</div> </div>
<div class="container mt-4"> <div class="container mt-4" >
<div class="row"> <div class="row">
<div class="col rounded-3 border border-secondary-subtle" style="background-color: #e9ecef;"> <div class="col rounded-3 border border-secondary-subtle" style="background-color: #e9ecef;">
<div class="row"> <div class="row">
@ -335,10 +378,10 @@
</div> </div>
</div> </div>
</div>
<!-- about section start --> <!-- about section start -->
<div class="tp-about__section pt-120 pb-90"> <div class="tp-about__section pt-120 pb-90" >
<div class="container"> <div class="container">
<div class="row align-items-center"> <div class="row align-items-center">
<div class="col-lg-7"> <div class="col-lg-7">

View File

@ -13,11 +13,12 @@
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
</head> </head>
<body class="antialiased"> <body class="antialiased">
<div class="container"> <div class="container-fluid">
<header <header
class="d-flex flex-wrap align-items-center justify-content-center justify-content-md-between py-3 mb-4 border-bottom"> class="d-flex flex-wrap align-items-center justify-content-center justify-content-md-between py-3 mb-4 border-bottom">
<ul class="nav col-9 col-md-auto mb-2 justify-content-start mb-md-0"> <ul class="nav col-9 col-md-auto mb-2 justify-content-start mb-md-0">
<li><a href="{{ route('dashboard') }}" class="nav-link px-2 link-secondary text-wrap" style="width: 4rem;">Главная</a></li> <li><a href="{{ route('dashboard') }}" class="nav-link px-2 link-secondary text-wrap" style="width: 4rem;">Главная</a>
</li>
</ul> </ul>
@ -52,9 +53,14 @@
<li class="list-group-item"><a href="{{ route('files.index') }}">Файлы</a></li> <li class="list-group-item"><a href="{{ route('files.index') }}">Файлы</a></li>
<li class="list-group-item"><a href="{{ route('admin-reception-screen.index') }}">Экран Приема</a></li> <li class="list-group-item"><a href="{{ route('admin-reception-screen.index') }}">Экран Приема</a></li>
@if(!is_null(Auth::getUser()) && Auth::getUser()->name === 'admin') @if(!is_null(Auth::getUser()) && Auth::getUser()->name === 'admin')
{{-- <li class="list-group-item"></li>--}} <li class="list-group-item"></li>
<li class="list-group-item"><a href="{{ route('users.index') }}">Список администраторов</a></li> <li class="list-group-item"><a href="{{ route('users.index') }}">Список администраторов</a></li>
@endif @endif
<li class="list-group-item"></li>
<li class="list-group-item">Справочники</li>
<li class="list-group-item"><a href="{{ route('educational-institutions.index') }}">Учебные
заведения</a></li>
<li class="list-group-item"><a href="{{ route('faculties.index') }}">Факультеты</a></li>
</ul> </ul>
</aside> </aside>
<div class="col-10">@yield('content')</div> <div class="col-10">@yield('content')</div>

View File

@ -214,7 +214,7 @@
<div class="row"> <div class="row">
<div class="col-lg-7"> <div class="col-lg-7">
<div class="tp-hero__content pt-200"> <div class="tp-hero__content pt-200">
<h3 class="tp-hero__title text-white mb-15">Поступление абитуриентов</h3> <h3 class="tp-hero__title text-white mb-15">Воплоти мечту <br> в реальность </h3>
<h5 class="title text-white">Выбирай! Решай! Действуй!</h5> <h5 class="title text-white">Выбирай! Решай! Действуй!</h5>
<div class="tp-hero__btn-wrappper d-md-flex align-items-center"> <div class="tp-hero__btn-wrappper d-md-flex align-items-center">
<div class="hero-btn-2"> <div class="hero-btn-2">
@ -260,67 +260,67 @@
<!-- brnad section start --> <!-- brnad section start -->
<div class="tp-brand__section"> {{--<div class="tp-brand__section">--}}
<div class="container"> {{-- <div class="container">--}}
<div class="row justify-content-center"> {{-- <div class="row justify-content-center">--}}
<div class="col-lg-12"> {{-- <div class="col-lg-12">--}}
<div class="tp-brand__box white-bg pt-40"> {{-- <div class="tp-brand__box white-bg pt-40">--}}
<div class="row"> {{-- <div class="row">--}}
<div class="col-xl-4 col-md-6"> {{-- <div class="col-xl-4 col-md-6">--}}
<h3>Факультеты</h3> {{-- <h3>Факультеты</h3>--}}
</div> {{-- </div>--}}
</div> {{-- </div>--}}
<div class="row"> {{-- <div class="row">--}}
<div class="col-12"> {{-- <div class="col-12">--}}
<div class="tp-brand_slider"> {{-- <div class="tp-brand_slider">--}}
<div class="tp-brand__item"> {{-- <div class="tp-brand__item">--}}
<img src="{{ URL::to('img/brand/agrar_fak.png') }}" alt=""> {{-- <img src="{{ URL::to('img/brand/agrar_fak.png') }}" alt="">--}}
</div> {{-- </div>--}}
<div class="tp-brand__item"> {{-- <div class="tp-brand__item">--}}
<img src="{{ URL::to('img/brand/eco_fak.png') }}" alt=""> {{-- <img src="{{ URL::to('img/brand/eco_fak.png') }}" alt="">--}}
</div> {{-- </div>--}}
<div class="tp-brand__item"> {{-- <div class="tp-brand__item">--}}
<img src="{{ URL::to('img/brand/ecolog_fak.png') }}" alt=""> {{-- <img src="{{ URL::to('img/brand/ecolog_fak.png') }}" alt="">--}}
</div> {{-- </div>--}}
<div class="tp-brand__item"> {{-- <div class="tp-brand__item">--}}
<img src="{{ URL::to('img/brand/fis_fak.png') }}" alt=""> {{-- <img src="{{ URL::to('img/brand/fis_fak.png') }}" alt="">--}}
</div> {{-- </div>--}}
<div class="tp-brand__item"> {{-- <div class="tp-brand__item">--}}
<img src="{{ URL::to('img/brand/farm_fak.png') }}" alt=""> {{-- <img src="{{ URL::to('img/brand/farm_fak.png') }}" alt="">--}}
</div> {{-- </div>--}}
<div class="tp-brand__item"> {{-- <div class="tp-brand__item">--}}
<img src="{{ URL::to('img/brand/inz_fak.png') }}" alt=""> {{-- <img src="{{ URL::to('img/brand/inz_fak.png') }}" alt="">--}}
</div> {{-- </div>--}}
<div class="tp-brand__item"> {{-- <div class="tp-brand__item">--}}
<img src="{{ URL::to('img/brand/lech_fak.png') }}" alt=""> {{-- <img src="{{ URL::to('img/brand/lech_fak.png') }}" alt="">--}}
</div> {{-- </div>--}}
<div class="tp-brand__item"> {{-- <div class="tp-brand__item">--}}
<img src="{{ URL::to('img/brand/med_inst.png') }}" alt=""> {{-- <img src="{{ URL::to('img/brand/med_inst.png') }}" alt="">--}}
</div> {{-- </div>--}}
<div class="tp-brand__item"> {{-- <div class="tp-brand__item">--}}
<img src="{{ URL::to('img/brand/mezd_fak.png') }}" alt=""> {{-- <img src="{{ URL::to('img/brand/mezd_fak.png') }}" alt="">--}}
</div> {{-- </div>--}}
<div class="tp-brand__item"> {{-- <div class="tp-brand__item">--}}
<img src="{{ URL::to('img/brand/pediatr_fak.png') }}" alt=""> {{-- <img src="{{ URL::to('img/brand/pediatr_fak.png') }}" alt="">--}}
</div> {{-- </div>--}}
<div class="tp-brand__item"> {{-- <div class="tp-brand__item">--}}
<img src="{{ URL::to('img/brand/posl_fak.png') }}" alt=""> {{-- <img src="{{ URL::to('img/brand/posl_fak.png') }}" alt="">--}}
</div> {{-- </div>--}}
<div class="tp-brand__item"> {{-- <div class="tp-brand__item">--}}
<img src="{{ URL::to('img/brand/stomat_fak.png') }}" alt=""> {{-- <img src="{{ URL::to('img/brand/stomat_fak.png') }}" alt="">--}}
</div> {{-- </div>--}}
<div class="tp-brand__item"> {{-- <div class="tp-brand__item">--}}
<img src="{{ URL::to('img/brand/tech_fak.png') }}" alt=""> {{-- <img src="{{ URL::to('img/brand/tech_fak.png') }}" alt="">--}}
</div> {{-- </div>--}}
</div> {{-- </div>--}}
</div> {{-- </div>--}}
</div> {{-- </div>--}}
</div> {{-- </div>--}}
</div> {{-- </div>--}}
</div> {{-- </div>--}}
</div> {{-- </div>--}}
</div> {{--</div>--}}
<!-- brnad section end --> <!-- brnad section end -->
<style> <style>

20
routes/admin.php Normal file
View File

@ -0,0 +1,20 @@
<?php
use App\Http\Controllers\EducationalInstitutionController;
use App\Http\Controllers\FacultyController;
use App\Http\Controllers\FileController;
use App\Http\Controllers\ReceptionScreenController;
use App\Http\Controllers\UserController;
Route::middleware(['auth', 'verified'])->group(function () {
Route::get('/files/create/{file?}', [FileController::class, 'create'])->name('files.create');
Route::get('/files/download/{file}', [FileController::class, 'download'])->name('files.download');
Route::resources([
'/files' => FileController::class,
'/users' => UserController::class,
'/admin-reception-screen' => ReceptionScreenController::class,
'/educational-institutions' => EducationalInstitutionController::class,
'/faculties' => FacultyController::class,
]);
});

84
routes/pages/web.php Normal file
View File

@ -0,0 +1,84 @@
<?php
use App\Http\Controllers\PageController;
use Illuminate\Support\Facades\Route;
Route::get('/', function () {
return view('home');
})->name('home');
Route::get('/course', function () {
return view('menu.course');
})->name('course');
Route::get('/applicant', function () {
return view('menu.abitur');
})->name('abitur');
Route::get('/for-foreign-applicants', function () {
return view('menu.inostrannym-abiturientam');
})->name('inostrannym-abiturientam');
Route::get('/paid_edu', function () {
return view('menu.paid_edu');
})->name('paid_edu');
Route::get('/olympiads-for-schoolchildren', function () {
return view('menu.olimpiady-dlya-shkolnikov');
})->name('olimpiady-dlya-shkolnikov');
Route::get('/training courses', function () {
return view('menu.podgotovitelnye-kursy');
})->name('podgotovitelnye-kursy');
Route::get('/reception-screens', [PageController::class, 'index'])->name('reception-screens');
Route::get('/web-consultations', function () {
return view('menu.abitur.web-consultations');
})->name('web-consultations');
Route::get('/specialty-magistracy', function () {
return view('menu.abitur.spetsialitet-magistratura');
})->name('spetsialitet-magistratura');
Route::get('/college', function () {
return view('menu.abitur.kolledzh');
})->name('kolledzh');
Route::get('/paid-educational-services', function () {
return view('menu.abitur.platnye-obrazovatelnye-uslugi');
})->name('platnye-obrazovatelnye-uslugi');
Route::get('/residency', function () {
return view('menu.abitur.ordinatura');
})->name('ordinatura');
Route::get('/traineeship', function () {
return view('menu.abitur.aspirantura');
})->name('aspirantura');
Route::get('/video-materials-for-applicants', function () {
return view('menu.abitur.videomaterialy-dlya-postupayushchikh');
})->name('videomaterialy-dlya-postupayushchikh');
Route::get('/international-activity', function () {
return view('menu.inostrannym-abiturientam.mezhdunarodnaya-deyatelnost');
})->name('mezhdunarodnaya-deyatelnost');
Route::get('/general-information', function () {
return view('menu.inostrannym-abiturientam.obshchie-svedeniya');
})->name('obshchie-svedeniya');
Route::get('/departments', function () {
return view('menu.inostrannym-abiturientam.kafedry');
})->name('kafedry');
Route::get('/international-education-center', function () {
return view('menu.inostrannym-abiturientam.tsentr-mezhdunarodnogo-obrazovaniya');
})->name('tsentr-mezhdunarodnogo-obrazovaniya');
Route::get('/academic-mobility-and-international-cooperation', function () {
return view('menu.inostrannym-abiturientam.akademicheskaya-mobilnost-i-mezhdunarodnoe-sotrudnichestvo');
})->name('akademicheskaya-mobilnost-i-mezhdunarodnoe-sotrudnichestvo');

View File

@ -1,114 +1,8 @@
<?php <?php
use App\Http\Controllers\FileController;
use App\Http\Controllers\PageController;
use App\Http\Controllers\ProfileController; use App\Http\Controllers\ProfileController;
use App\Http\Controllers\ReceptionScreenController;
use App\Http\Controllers\UserController;
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/
Route::get('/', function () {
return view('home');
})->name('home');
Route::resource('/users', UserController::class)->middleware(['auth', 'verified']);
Route::resource('/admin-reception-screen', ReceptionScreenController::class)->middleware(['auth', 'verified']);
Route::get('/files', [FileController::class, 'index'])->name('files.index');
Route::post('/files', [FileController::class, 'store'])->name('files.store');
Route::get('/files/create/{file?}', [FileController::class, 'create'])->name('files.create');
Route::patch('/files/{file}', [FileController::class, 'update'])->name('files.update');
Route::delete('files/{file}', [FileController::class, 'destroy'])->name('files.destroy');
Route::get('/files/edit/{file}', [FileController::class, 'edit'])->name('files.edit');
Route::get('/files/download/{file}', [FileController::class, 'download'])->name('files.download');
Route::get('/course', function () {
return view('menu.course');
})->name('course');
Route::get('/applicant', function () {
return view('menu.abitur');
})->name('abitur');
Route::get('/for-foreign-applicants', function () {
return view('menu.inostrannym-abiturientam');
})->name('inostrannym-abiturientam');
Route::get('/paid_edu', function () {
return view('menu.paid_edu');
})->name('paid_edu');
Route::get('/olympiads-for-schoolchildren', function () {
return view('menu.olimpiady-dlya-shkolnikov');
})->name('olimpiady-dlya-shkolnikov');
Route::get('/training courses', function () {
return view('menu.podgotovitelnye-kursy');
})->name('podgotovitelnye-kursy');
Route::get('/reception-screens', [PageController::class, 'index'])->name('reception-screens');
Route::get('/web-consultations', function () {
return view('menu.abitur.web-consultations');
})->name('web-consultations');
Route::get('/specialty-magistracy', function () {
return view('menu.abitur.spetsialitet-magistratura');
})->name('spetsialitet-magistratura');
Route::get('/college', function () {
return view('menu.abitur.kolledzh');
})->name('kolledzh');
Route::get('/paid-educational-services', function () {
return view('menu.abitur.platnye-obrazovatelnye-uslugi');
})->name('platnye-obrazovatelnye-uslugi');
Route::get('/residency', function () {
return view('menu.abitur.ordinatura');
})->name('ordinatura');
Route::get('/traineeship', function () {
return view('menu.abitur.aspirantura');
})->name('aspirantura');
Route::get('/video-materials-for-applicants', function () {
return view('menu.abitur.videomaterialy-dlya-postupayushchikh');
})->name('videomaterialy-dlya-postupayushchikh');
Route::get('/international-activity', function () {
return view('menu.inostrannym-abiturientam.mezhdunarodnaya-deyatelnost');
})->name('mezhdunarodnaya-deyatelnost');
Route::get('/general-information', function () {
return view('menu.inostrannym-abiturientam.obshchie-svedeniya');
})->name('obshchie-svedeniya');
Route::get('/departments', function () {
return view('menu.inostrannym-abiturientam.kafedry');
})->name('kafedry');
Route::get('/international-education-center', function () {
return view('menu.inostrannym-abiturientam.tsentr-mezhdunarodnogo-obrazovaniya');
})->name('tsentr-mezhdunarodnogo-obrazovaniya');
Route::get('/academic-mobility-and-international-cooperation', function () {
return view('menu.inostrannym-abiturientam.akademicheskaya-mobilnost-i-mezhdunarodnoe-sotrudnichestvo');
})->name('akademicheskaya-mobilnost-i-mezhdunarodnoe-sotrudnichestvo');
Route::get('/dashboard', function () { Route::get('/dashboard', function () {
return view('admin'); return view('admin');
})->middleware(['auth', 'verified'])->name('dashboard'); })->middleware(['auth', 'verified'])->name('dashboard');
@ -120,3 +14,5 @@ Route::middleware('auth')->group(function () {
}); });
require __DIR__ . '/auth.php'; require __DIR__ . '/auth.php';
require __DIR__ . '/admin.php';
require __DIR__ . '/pages/web.php';