Migrate backend to Porto architecture and fix minor bugs

- Fully transitioned the backend to the Porto architectural pattern
- Improved code organization and maintainability
- Fixed minor bugs and inconsistencies
This commit is contained in:
F4ilji
2025-05-12 08:47:43 +05:00
parent 76deaf75f3
commit c01016a154
620 changed files with 16218 additions and 6073 deletions
@@ -1,32 +0,0 @@
<?php
namespace App\Http\Requests\ApplicantQuestion;
use Illuminate\Foundation\Http\FormRequest;
class StoreRequest 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 [
'first_name' => 'required|string|min:2',
'last_name' => 'required|string|min:2',
'email' => 'required|email|min:2',
'phone' => 'required|numeric|min:11',
'text' => 'required|string|min:10',
];
}
}
@@ -1,29 +0,0 @@
<?php
namespace App\Http\Requests\Department;
use Illuminate\Foundation\Http\FormRequest;
class StoreRequest 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 [
'title' => 'required|unique:faculties|min:2',
'faculty_id' => 'required|exists:faculties,id'
];
}
}
@@ -1,29 +0,0 @@
<?php
namespace App\Http\Requests\Department;
use Illuminate\Foundation\Http\FormRequest;
class UpdateRequest 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 [
'title' => 'required|min:2|unique:faculties',
'faculty_id' => 'required|exists:faculties,id'
];
}
}
@@ -1,30 +0,0 @@
<?php
namespace App\Http\Requests\Division;
use Illuminate\Foundation\Http\FormRequest;
class StoreRequest 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 [
'title' => 'required|string',
'description' => 'required|array',
'description.blocks' => 'required|array|min:1',
];
}
}
@@ -1,30 +0,0 @@
<?php
namespace App\Http\Requests\Division;
use Illuminate\Foundation\Http\FormRequest;
class UpdateRequest 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 [
'title' => 'required|string',
'description' => 'required|array',
'description.blocks' => 'required|array|min:1',
];
}
}
-33
View File
@@ -1,33 +0,0 @@
<?php
namespace App\Http\Requests\Event;
use Illuminate\Foundation\Http\FormRequest;
class StoreRequest 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 [
'title' => 'required|max:255|min:5',
'content' => 'required|array',
'content.blocks' => 'required|array|min:1',
'event_date' => 'required|date',
'address' => 'string',
'is_online' => 'required|boolean',
];
}
}
-34
View File
@@ -1,34 +0,0 @@
<?php
namespace App\Http\Requests\Event;
use Illuminate\Foundation\Http\FormRequest;
class UpdateRequest 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 [
'title' => 'required|max:255|min:5',
'content' => 'required|array',
'content.blocks' => 'required|array|min:1',
'event_date' => 'required|date',
'address' => 'string',
'is_online' => 'required|boolean',
];
}
}
@@ -1,28 +0,0 @@
<?php
namespace App\Http\Requests\Faculty;
use Illuminate\Foundation\Http\FormRequest;
class StoreRequest 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 [
'title' => 'required|unique:faculties|min:2'
];
}
}
@@ -1,28 +0,0 @@
<?php
namespace App\Http\Requests\Faculty;
use Illuminate\Foundation\Http\FormRequest;
class UpdateRequest 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 [
'title' => 'required|min:2|unique:faculties',
];
}
}
-37
View File
@@ -1,37 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class FormResponseRequest extends FormRequest
{
private array $rules;
public function __construct(array $rules)
{
$this->rules = $rules;
}
/**
* 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
{
dd(1);
return [
];
}
}
-34
View File
@@ -1,34 +0,0 @@
<?php
namespace App\Http\Requests\Page;
use Illuminate\Foundation\Http\FormRequest;
class StoreRequest 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 [
'title' => 'required|max:255|min:5',
'content' => 'required|array',
'content.blocks' => 'required|array|min:1',
'code' => 'required|integer',
'slug' => 'required|unique:pages,slug',
'path' => 'required|unique:pages,path',
'search_data' => 'required|string'
];
}
}
-33
View File
@@ -1,33 +0,0 @@
<?php
namespace App\Http\Requests\Page;
use Illuminate\Foundation\Http\FormRequest;
class UpdateRequest 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 [
'title' => 'required|max:255|min:5',
'content' => 'required|array',
'content.blocks' => 'required|array|min:1',
'code' => 'required|integer',
'slug' => 'required|unique:pages,slug,'.$this->id,
'path' => 'required|unique:pages,path,'.$this->id,
];
}
}
-35
View File
@@ -1,35 +0,0 @@
<?php
namespace App\Http\Requests\Post;
use Illuminate\Foundation\Http\FormRequest;
class StoreRequest 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 [
'title' => 'required|max:255|min:5',
'content' => 'required|array',
'content.blocks' => 'required|array|min:1',
'is_published' => 'required|boolean',
'category_id' => 'nullable|exists:categories,id',
'author' => 'nullable|string|min:5',
'images' => 'nullable|array',
'search_data' => 'required|string'
];
}
}
@@ -1,23 +0,0 @@
<?php
namespace App\Http\Requests;
use App\Models\User;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class ProfileUpdateRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function rules(): array
{
return [
'name' => ['string', 'max:255'],
'email' => ['email', 'max:255', Rule::unique(User::class)->ignore($this->user()->id)],
];
}
}
@@ -1,32 +0,0 @@
<?php
namespace App\Http\Requests\Schedule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rules\File;
class StoreRequest 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 [
'faculty_id' => 'required|exists:faculties,id|integer',
'is_fullTime' => 'required|boolean',
'files' => 'required|array',
'files.*' => ['required', File::types('pdf')]
];
}
}
@@ -1,35 +0,0 @@
<?php
namespace App\Http\Requests\Student;
use Illuminate\Foundation\Http\FormRequest;
class StoreRequest 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|string',
'surname' => 'required|string',
'middleName' => 'nullable|string',
'position' => 'nullable|string',
'education' => 'nullable|string',
'vk_link' => 'nullable|string',
'contactEmail' => 'nullable|email',
'contactPhone' => 'nullable|string',
];
}
}
@@ -1,35 +0,0 @@
<?php
namespace App\Http\Requests\Student;
use Illuminate\Foundation\Http\FormRequest;
class UpdateRequest 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|string',
'surname' => 'required|string',
'middleName' => 'nullable|string',
'position' => 'nullable|string',
'education' => 'nullable|string',
'vk_link' => 'nullable|string',
'contactEmail' => 'nullable|email',
'contactPhone' => 'nullable|string',
];
}
}
-29
View File
@@ -1,29 +0,0 @@
<?php
namespace App\Http\Requests\User;
use Illuminate\Foundation\Http\FormRequest;
class StoreRequest 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 [
'email' => 'required|email',
'password' => 'required|min:6|confirmed',
];
}
}
-28
View File
@@ -1,28 +0,0 @@
<?php
namespace App\Http\Requests\User;
use Illuminate\Foundation\Http\FormRequest;
class UpdateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
//
];
}
}
@@ -1,45 +0,0 @@
<?php
namespace App\Http\Requests\UserDetail;
use Illuminate\Foundation\Http\FormRequest;
class StoreRequest 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 [
'user_id' => 'required|exists:users,id|integer',
'name' => 'required|string',
'surname' => 'required|string',
'middleName' => 'nullable|string',
'academicTitle' => 'nullable|string',
'educatorPosition' => 'nullable|string',
'education' => 'nullable|string',
'awards' => 'nullable|string',
'professDisciplines' => 'nullable|string',
'professionalRetraining' => 'nullable|string',
'professionalDevelopment' => 'nullable|string',
'workExperience' => 'nullable|integer',
'attendedConferences' => 'nullable|string',
'participationScience_projects' => 'nullable|string',
'publications' => 'nullable|string',
'trainingAids' => 'nullable|string',
'contactEmail' => 'nullable|email',
'contactPhone' => 'nullable|string',
];
}
}
@@ -1,44 +0,0 @@
<?php
namespace App\Http\Requests\UserDetail;
use Illuminate\Foundation\Http\FormRequest;
class UpdateRequest 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|string',
'surname' => 'required|string',
'middleName' => 'nullable|string',
'academicTitle' => 'nullable|string',
'educatorPosition' => 'nullable|string',
'education' => 'nullable|string',
'awards' => 'nullable|string',
'professDisciplines' => 'nullable|string',
'professionalRetraining' => 'nullable|string',
'professionalDevelopment' => 'nullable|string',
'workExperience' => 'nullable|integer',
'attendedConferences' => 'nullable|string',
'participationScience_projects' => 'nullable|string',
'publications' => 'nullable|string',
'trainingAids' => 'nullable|string',
'contactEmail' => 'nullable|email',
'contactPhone' => 'nullable|string',
];
}
}