forked from aslan/applicant-site
prodV1 #2
|
@ -59,21 +59,21 @@ jobs:
|
|||
- name: Check tests
|
||||
run: make test
|
||||
|
||||
# deploy:
|
||||
# needs: build
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - name: deploy to test server
|
||||
# uses: appleboy/ssh-action@v1.0.3
|
||||
#
|
||||
# with:
|
||||
# host: ${{ secrets.HOST }}
|
||||
# username: ${{ secrets.USERNAME }}
|
||||
# password: ${{ secrets.PASSWORD }}
|
||||
# port: ${{ secrets.PORT }}
|
||||
# script: |
|
||||
# cd /var/www/test-testabit/
|
||||
# git stash
|
||||
# git pull --rebase
|
||||
# git stash clear
|
||||
# make setup-test
|
||||
deploy:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: deploy to test server
|
||||
uses: appleboy/ssh-action@v1.0.3
|
||||
|
||||
with:
|
||||
host: ${{ secrets.HOST }}
|
||||
username: ${{ secrets.USERNAME }}
|
||||
password: ${{ secrets.PASSWORD }}
|
||||
port: ${{ secrets.PORT }}
|
||||
script: |
|
||||
cd /var/www/www-root/data/www/testabit.mkgtu.ru
|
||||
git stash
|
||||
git pull --rebase
|
||||
git stash clear
|
||||
make setup-prod
|
||||
|
|
7
Makefile
7
Makefile
|
@ -15,13 +15,8 @@ setup:
|
|||
npm run build
|
||||
make ide-helper
|
||||
|
||||
setup-test:
|
||||
setup-prod:
|
||||
composer install
|
||||
cp -n .env.example .env
|
||||
php artisan key:gen --ansi
|
||||
touch database/database.sqlite
|
||||
php artisan migrate:refresh
|
||||
php artisan db:seed
|
||||
npm ci
|
||||
npm run build
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace App\Helpers;
|
|||
|
||||
use App\Models\Direction;
|
||||
use App\Models\Faculty;
|
||||
use App\Models\EducationalInstitution;
|
||||
|
||||
class PositionHelper
|
||||
{
|
||||
|
@ -18,4 +19,10 @@ class PositionHelper
|
|||
$maxPosition = Direction::max('position');
|
||||
return $maxPosition >= 254 ? 255 : $maxPosition + 1;
|
||||
}
|
||||
|
||||
public static function educationalInstitution()
|
||||
{
|
||||
$maxPosition = EducationalInstitution::max('position');
|
||||
return $maxPosition >= 254 ? 255 : $maxPosition + 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,8 +50,10 @@ class FacultyController extends Controller
|
|||
$faculty->save();
|
||||
|
||||
Log::channel('app')
|
||||
->info('CREATE факультет {faculty} - user {user}',
|
||||
['user' => Auth::user()->name, 'faculty' => $faculty->name, 'data' => $validated]);
|
||||
->info(
|
||||
'CREATE факультет {faculty} - user {user}',
|
||||
['user' => Auth::user()->name, 'faculty' => $faculty->name, 'data' => $validated]
|
||||
);
|
||||
|
||||
return redirect()->route('faculties.index');
|
||||
}
|
||||
|
@ -79,8 +81,15 @@ class FacultyController extends Controller
|
|||
$faculty->educational_institution_id = $validated['educational_institution_id'];
|
||||
|
||||
Log::channel('app')
|
||||
->info('UPDATE факультет {faculty} - user {user}',
|
||||
['user' => Auth::user()->name, 'faculty' => $faculty->name, 'oldData' => $oldData, 'newData' => $validated]);
|
||||
->info(
|
||||
'UPDATE факультет {faculty} - user {user}',
|
||||
[
|
||||
'user' => Auth::user()->name,
|
||||
'faculty' => $faculty->name,
|
||||
'oldData' => $oldData,
|
||||
'newData' => $validated
|
||||
]
|
||||
);
|
||||
|
||||
$faculty->save();
|
||||
return redirect()->route('faculties.index');
|
||||
|
@ -89,8 +98,10 @@ class FacultyController extends Controller
|
|||
public function destroy(Faculty $faculty): RedirectResponse
|
||||
{
|
||||
Log::channel('app')
|
||||
->info('DELETE факультет {faculty} - user {user}',
|
||||
['user' => Auth::user()->name, 'faculty' => $faculty->name, 'data' => $faculty->toArray()]);
|
||||
->info(
|
||||
'DELETE факультет {faculty} - user {user}',
|
||||
['user' => Auth::user()->name, 'faculty' => $faculty->name, 'data' => $faculty->toArray()]
|
||||
);
|
||||
|
||||
if ($faculty->departments()->exists()) {
|
||||
return back();
|
||||
|
|
|
@ -10,10 +10,10 @@ return new class extends Migration
|
|||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('email')->unique();
|
||||
$table->string('name', 255);
|
||||
$table->string('email', 255)->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$table->string('password', 255);
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
|
|
@ -10,10 +10,10 @@ return new class extends Migration
|
|||
{
|
||||
Schema::create('admissions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('name', 255)->unique();
|
||||
$table->text('description')->nullable();
|
||||
$table->string('slug');
|
||||
$table->integer('position');
|
||||
$table->string('slug', 255)->unique();
|
||||
$table->smallInteger('position');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -10,11 +10,11 @@ return new class extends Migration
|
|||
{
|
||||
Schema::create('documents', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('name', 255)->unique();
|
||||
$table->string('file_name')->nullable();
|
||||
$table->text('description')->nullable();
|
||||
$table->string('url');
|
||||
$table->integer('position');
|
||||
$table->string('url', 255);
|
||||
$table->smallInteger('position');
|
||||
$table->foreignId('admission_id')->constrained('admissions');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
|
|
@ -10,10 +10,10 @@ return new class extends Migration
|
|||
{
|
||||
Schema::create('educational_institutions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('slug');
|
||||
$table->string('name', 255)->unique();
|
||||
$table->string('slug', 255)->unique();
|
||||
$table->text('description')->nullable();
|
||||
$table->integer('position');
|
||||
$table->smallInteger('position');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -10,10 +10,10 @@ return new class extends Migration
|
|||
{
|
||||
Schema::create('faculties', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name')->unique();
|
||||
$table->string('name', 255)->unique();
|
||||
$table->text('description')->nullable();
|
||||
$table->integer('position');
|
||||
$table->string('slug')->unique();
|
||||
$table->smallInteger('position');
|
||||
$table->string('slug', 255)->unique();
|
||||
$table->foreignId('educational_institution_id')->constrained('educational_institutions');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
|
|
@ -10,10 +10,10 @@ return new class extends Migration
|
|||
{
|
||||
Schema::create('departments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('name', 255)->unique();
|
||||
$table->text('description')->nullable();
|
||||
$table->integer('position');
|
||||
$table->string('slug');
|
||||
$table->smallInteger('position');
|
||||
$table->string('slug', 255)->unique();
|
||||
$table->foreignId('faculty_id')->constrained('faculties');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
|
|
@ -10,9 +10,9 @@ return new class extends Migration
|
|||
{
|
||||
Schema::create('education_forms', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('name', 255)->unique();
|
||||
$table->text('description')->nullable();
|
||||
$table->string('slug');
|
||||
$table->string('slug', 255)->unique();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -10,9 +10,9 @@ return new class extends Migration
|
|||
{
|
||||
Schema::create('education_levels', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('name', 255)->unique();
|
||||
$table->text('description')->nullable();
|
||||
$table->string('slug');
|
||||
$table->string('slug', 255)->unique();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -10,19 +10,19 @@ return new class extends Migration
|
|||
{
|
||||
Schema::create('directions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('full_name');
|
||||
$table->string('name', 255)->unique();
|
||||
$table->string('full_name', 255);
|
||||
$table->text('description')->nullable();
|
||||
$table->string('code');
|
||||
$table->integer('position');
|
||||
$table->string('slug');
|
||||
$table->string('code', 255);
|
||||
$table->smallInteger('position');
|
||||
$table->string('slug', 255)->unique();
|
||||
$table->foreignId('department_id')->constrained('departments');
|
||||
$table->foreignId('education_level_id')->constrained('education_levels');
|
||||
$table->foreignId('education_form_id')->constrained('education_forms');
|
||||
$table->integer('budget_places');
|
||||
$table->integer('quota');
|
||||
$table->integer('paid_places');
|
||||
$table->integer('cost_paid_place');
|
||||
$table->smallInteger('budget_places');
|
||||
$table->smallInteger('quota');
|
||||
$table->smallInteger('paid_places');
|
||||
$table->smallInteger('cost_paid_place');
|
||||
$table->float('period');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
|
|
@ -10,10 +10,10 @@ return new class extends Migration
|
|||
{
|
||||
Schema::create('examination_types', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('position');
|
||||
$table->string('name');
|
||||
$table->smallInteger('position');
|
||||
$table->string('name', 255)->unique();
|
||||
$table->text('description')->nullable();
|
||||
$table->string('slug');
|
||||
$table->string('slug', 255)->unique();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -10,10 +10,10 @@ return new class extends Migration
|
|||
{
|
||||
Schema::create('subject_types', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('position');
|
||||
$table->string('name');
|
||||
$table->smallInteger('position');
|
||||
$table->string('name', 255)->unique();
|
||||
$table->text('description')->nullable();
|
||||
$table->string('slug');
|
||||
$table->string('slug', 255)->unique();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -13,10 +13,10 @@ return new class extends Migration
|
|||
{
|
||||
Schema::create('subjects', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('position');
|
||||
$table->string('name');
|
||||
$table->smallInteger('position');
|
||||
$table->string('name', 255)->unique();
|
||||
$table->text('description')->nullable();
|
||||
$table->string('slug');
|
||||
$table->string('slug', 255)->unique();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@ return new class extends Migration
|
|||
$table->foreignId('examination_type_id')->constrained('examination_types');
|
||||
$table->foreignId('direction_id')->constrained('directions');
|
||||
$table->foreignId('subject_id')->constrained('subjects');
|
||||
$table->integer('scores');
|
||||
$table->integer('position');
|
||||
$table->tinyInteger('scores');
|
||||
$table->smallInteger('position');
|
||||
$table->foreignId('subject_type_id')->constrained('subject_types');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
|
|
@ -13,10 +13,10 @@ return new class extends Migration
|
|||
{
|
||||
Schema::create('direction_profiles', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('name', 255)->unique();
|
||||
$table->text('description')->nullable();
|
||||
$table->string('slug');
|
||||
$table->string('position');
|
||||
$table->string('slug', 255)->unique();
|
||||
$table->smallInteger('position');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -34,4 +34,10 @@ return [
|
|||
'scores' => 'Поле "Кол-во баллов" указывает на привязку вступительного испытания к Кол-ву баллов',
|
||||
'position' => 'Поле "Позиция" нужно для упорядочивания отображения на сайте',
|
||||
],
|
||||
'educational_institutions' => [
|
||||
'position' => 'Поле "Позиция" нужно для упорядочивания отображения на сайте',
|
||||
'name' => 'Поле "Название" должно быть уникальным для отображения на сайте',
|
||||
'description' => 'Поле "Описание" может быть пустым для отображения на сайте',
|
||||
'slug' => 'Поле "URL" нужно для отображения в браузере'
|
||||
],
|
||||
];
|
||||
|
|
|
@ -4,50 +4,58 @@
|
|||
<div class="row">
|
||||
<div class="col">
|
||||
<h1 class=""> Создать учебное заведение</h1>
|
||||
{{ Form::open(['url' => route('educational_institutions.store'), 'method' => 'POST', 'class' => '']) }}
|
||||
{{ Form::open(['url' => route('educational_institutions.store'), 'method' => 'POST', 'class' => 'needs-validation', 'novalidate']) }}
|
||||
<div class="col">
|
||||
<div>
|
||||
{{ Form::label('position', 'Позиция') }}
|
||||
{{ Form::label('position', 'Позиция', ['data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.educational_institutions.position')]) }}
|
||||
<span class="text-danger">*</span>
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
{{ Form::text('position', '', ['class' => 'form-control']) }}
|
||||
{{ Form::text('position', PositionHelper::educationalInstitution(), ['class' => 'form-control', 'data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.educational_institutions.position'), 'required']) }}
|
||||
<div class="invalid-feedback">
|
||||
Поле "Позиция" обязательно!
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="text-danger">
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('position') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{{ Form::label('name', 'Название') }}
|
||||
{{ Form::label('name', 'Название', ['data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.educational_institutions.name')]) }}
|
||||
<span class="text-danger">*</span>
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
{{ Form::text('name', '', ['class' => 'form-control']) }}
|
||||
{{ Form::text('name', '', ['class' => 'form-control', 'data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.educational_institutions.name'), 'required']) }}
|
||||
<div class="invalid-feedback">
|
||||
Поле "Название" обязательно!
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="text-danger">
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('name') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{{ Form::label('description', 'Описание') }}
|
||||
{{ Form::label('description', 'Описание', ['data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.educational_institutions.description')]) }}
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
{{ Form::text('description', '', ['class' => 'form-control']) }}
|
||||
{{ Form::text('description', '', ['class' => 'form-control', 'data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.educational_institutions.description')]) }}
|
||||
</div>
|
||||
<div>
|
||||
<div class="text-danger">
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('description') }}
|
||||
@endif
|
||||
</div>
|
||||
<div class="mt-3">
|
||||
{{ Form::label('slug', 'URL') }}
|
||||
{{ Form::label('slug', 'URL', ['data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.educational_institutions.slug')]) }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::text('slug', '', ['class' => 'form-control']) }}
|
||||
</div>
|
||||
<div>
|
||||
<div class="text-danger">
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('slug') }}
|
||||
@endif
|
||||
|
|
Loading…
Reference in New Issue