Compare commits
78 Commits
feature/Mu
...
feature/Fi
| Author | SHA1 | Date | |
|---|---|---|---|
| 17fbf0dcfe | |||
| 5040299efc | |||
| 26a0f79a6d | |||
| 1b5d339a53 | |||
| c73d50d096 | |||
| 8be89d350f | |||
| d31c641216 | |||
| aa363d1695 | |||
| ca2ec66fb5 | |||
| 5c757e1823 | |||
| d9f895c382 | |||
| 9ad3d6cea0 | |||
| 8554f4cc55 | |||
| 5e48777e1c | |||
| 01bae8474b | |||
| 463ca3f006 | |||
| 1ba141e715 | |||
| 76e6ab4e0c | |||
| fb35ed58b1 | |||
| ffb4179e0d | |||
| a7fa1097b7 | |||
| f2f9d38907 | |||
| 5b79cefe28 | |||
| 41b7ead69e | |||
| 5ea986db40 | |||
| d04637b1ef | |||
| 3c61e279ec | |||
| e9f6ee71fa | |||
| 60129f5abb | |||
| 2d8f2dbcc5 | |||
| 86e353749a | |||
| f3a9b5e788 | |||
| d04277ece5 | |||
| e53a89016f | |||
| 53f2303253 | |||
| c6dc5256e6 | |||
| 19abb28acf | |||
| 431acd9279 | |||
| 9fcd8045db | |||
| 7c82556d93 | |||
| 581e7af1fd | |||
| b433d2ff52 | |||
| 6f06218cb2 | |||
| af23df5527 | |||
| 1a2077a164 | |||
| e33aac7eed | |||
| 7b0507bdda | |||
| ae8ca057fd | |||
| 32c14bd6c4 | |||
| 363c7005d0 | |||
| f29510d76e | |||
| 5596943b70 | |||
| 5831a5594a | |||
| 12736d53c5 | |||
| fda129875e | |||
| ca71547657 | |||
| 2d31eccc4a | |||
| abb92b4e22 | |||
| ea68943354 | |||
| e3831e98c9 | |||
| 9794aa1f54 | |||
| 4afcd5c81e | |||
| 74bc255d82 | |||
| ca094cff9f | |||
| c2328ec666 | |||
| e4f7b96b92 | |||
| f072bd1ee8 | |||
| f01992368e | |||
| 161fa3ae1e | |||
| b32ee444ca | |||
| cee480fff5 | |||
| 5024a242d2 | |||
| 0bba710b7d | |||
| f788f9a7ea | |||
| e74619d0ab | |||
| 5b42e23afc | |||
| 51aa3b157c | |||
| ccd2de26df |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
.idea
|
.idea
|
||||||
.env
|
.env
|
||||||
|
front
|
||||||
0
backend/.dockerignore
Normal file → Executable file
0
backend/.dockerignore
Normal file → Executable file
0
backend/.editorconfig
Normal file → Executable file
0
backend/.editorconfig
Normal file → Executable file
0
backend/.env.example
Normal file → Executable file
0
backend/.env.example
Normal file → Executable file
0
backend/.gitattributes
vendored
Normal file → Executable file
0
backend/.gitattributes
vendored
Normal file → Executable file
0
backend/.gitignore
vendored
Normal file → Executable file
0
backend/.gitignore
vendored
Normal file → Executable file
0
backend/.npmrc
Normal file → Executable file
0
backend/.npmrc
Normal file → Executable file
1
backend/Dockerfile
Normal file → Executable file
1
backend/Dockerfile
Normal file → Executable file
@@ -30,7 +30,6 @@ ENV COMPOSER_ALLOW_SUPERUSER=1
|
|||||||
# Default command
|
# Default command
|
||||||
CMD composer install ;\
|
CMD composer install ;\
|
||||||
composer dump-autoload --optimize --classmap-authoritative ;\
|
composer dump-autoload --optimize --classmap-authoritative ;\
|
||||||
php artisan key:generate ;\
|
|
||||||
php artisan migrate ;\
|
php artisan migrate ;\
|
||||||
php artisan db:seed ;\
|
php artisan db:seed ;\
|
||||||
php-fpm
|
php-fpm
|
||||||
|
|||||||
0
backend/Dockerfile.production
Normal file → Executable file
0
backend/Dockerfile.production
Normal file → Executable file
0
backend/README.md
Normal file → Executable file
0
backend/README.md
Normal file → Executable file
48
backend/app/Admin/Controllers/AuthController.php
Executable file
48
backend/app/Admin/Controllers/AuthController.php
Executable file
@@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Admin\Requests\Auth\LoginRequest;
|
||||||
|
use App\Admin\Requests\Auth\RegisterRequest;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Expert;
|
||||||
|
use App\Traits\ApiResponse;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
|
||||||
|
class AuthController extends Controller
|
||||||
|
{
|
||||||
|
use ApiResponse;
|
||||||
|
|
||||||
|
public function login(LoginRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
$credentials = ['password' => $request->password];
|
||||||
|
|
||||||
|
if (filter_var($request->login, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
$credentials['email'] = $request->login;
|
||||||
|
} else {
|
||||||
|
$credentials['username'] = $request->login;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Auth::guard('expert')->attempt($credentials)) {
|
||||||
|
$request->session()->regenerate();
|
||||||
|
|
||||||
|
return $this->successResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->errorResponse(__('messages.incorrect_or_username_password'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function logout(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
Auth::guard('expert')->logout();
|
||||||
|
|
||||||
|
$request->session()->invalidate();
|
||||||
|
|
||||||
|
$request->session()->regenerateToken();
|
||||||
|
|
||||||
|
return $this->successResponse();
|
||||||
|
}
|
||||||
|
}
|
||||||
55
backend/app/Admin/Controllers/DocumentationController.php
Executable file
55
backend/app/Admin/Controllers/DocumentationController.php
Executable file
@@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Admin\Requests\Documentation\RejectRequest;
|
||||||
|
use App\Facades\DataTable\DataTableFacade;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Traits\ApiResponse;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class DocumentationController extends Controller
|
||||||
|
{
|
||||||
|
use ApiResponse;
|
||||||
|
|
||||||
|
public function index(Request $request): array
|
||||||
|
{
|
||||||
|
return DataTableFacade::run(
|
||||||
|
User::query(),
|
||||||
|
$request,
|
||||||
|
allowedFilters: ['*'],
|
||||||
|
allowedSortings: ['*'],
|
||||||
|
allowedSelects: [
|
||||||
|
'id', 'first_name', 'last_name', 'national_id',
|
||||||
|
'phone_number', 'postal_code', 'city_id', 'province_id',
|
||||||
|
'province_name', 'city_name', 'address'
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function files(User $user): JsonResponse
|
||||||
|
{
|
||||||
|
return $this->successResponse($user->load('documents'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function confirm(User $user): JsonResponse
|
||||||
|
{
|
||||||
|
$user->update([
|
||||||
|
'authority_level' => 1
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $this->successResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reject(RejectRequest $request, User $user): JsonResponse
|
||||||
|
{
|
||||||
|
$user->update([
|
||||||
|
'kyc_status' => 0,
|
||||||
|
'kyc_reject_reason' => $request->kyc_reject_reason
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $this->successResponse();
|
||||||
|
}
|
||||||
|
}
|
||||||
112
backend/app/Admin/Controllers/ExpertManagementController.php
Executable file
112
backend/app/Admin/Controllers/ExpertManagementController.php
Executable file
@@ -0,0 +1,112 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Admin\Requests\ExpertManagement\StoreRequest;
|
||||||
|
use App\Admin\Requests\ExpertManagement\UpdateRequest;
|
||||||
|
use App\Facades\DataTable\DataTableFacade;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\City;
|
||||||
|
use App\Models\Expert;
|
||||||
|
use App\Models\Province;
|
||||||
|
use App\Traits\ApiResponse;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
class ExpertManagementController extends Controller
|
||||||
|
{
|
||||||
|
use ApiResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$data = DataTableFacade::run(
|
||||||
|
Expert::query(),
|
||||||
|
$request,
|
||||||
|
allowedFilters: ['*'],
|
||||||
|
allowedSortings: ['*'],
|
||||||
|
allowedSelects: ['id', 'username', 'first_name', 'last_name', 'phone_number', 'email', 'national_id'],
|
||||||
|
);
|
||||||
|
|
||||||
|
return response()->json($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(StoreRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
$province = Province::query()->find($request->province_id);
|
||||||
|
$city = City::query()->find($request->city_id);
|
||||||
|
|
||||||
|
Expert::query()->create([
|
||||||
|
'username' => $request->username,
|
||||||
|
'first_name' => $request->first_name,
|
||||||
|
'last_name' => $request->last_name,
|
||||||
|
'national_id' => $request->national_id,
|
||||||
|
'password' => Hash::make($request->password),
|
||||||
|
'email' => $request->email,
|
||||||
|
'phone_number' => $request->phone_number,
|
||||||
|
'province_id' => $request->province_id,
|
||||||
|
'province_name' => $province->name,
|
||||||
|
'city_id' => $request->city_id,
|
||||||
|
'city_name' => $city->name,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $this->successResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified resource.
|
||||||
|
*/
|
||||||
|
public function show(Expert $expert): JsonResponse
|
||||||
|
{
|
||||||
|
return $this->successResponse($expert->load(['roles','permissions'])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(UpdateRequest $request, Expert $expert): JsonResponse
|
||||||
|
{
|
||||||
|
$province = Province::query()->find($request->province_id);
|
||||||
|
$city = City::query()->find($request->city_id);
|
||||||
|
|
||||||
|
$expert->update([
|
||||||
|
'username' => $request->username,
|
||||||
|
'first_name' => $request->first_name,
|
||||||
|
'last_name' => $request->last_name,
|
||||||
|
'national_id' => $request->national_id,
|
||||||
|
'password' => Hash::make($request->password),
|
||||||
|
'email' => $request->email,
|
||||||
|
'phone_number' => $request->phone_number,
|
||||||
|
'province_id' => $request->province_id,
|
||||||
|
'province_name' => $province->name,
|
||||||
|
'city_id' => $request->city_id,
|
||||||
|
'city_name' => $city->name,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $this->successResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
* @throws Throwable
|
||||||
|
*/
|
||||||
|
public function destroy(Expert $expert): JsonResponse
|
||||||
|
{
|
||||||
|
DB::transaction(function () use ($expert) {
|
||||||
|
$expert->roles()->detach();
|
||||||
|
$expert->permissions()->detach();
|
||||||
|
$expert->delete();
|
||||||
|
});
|
||||||
|
|
||||||
|
return $this->successResponse();
|
||||||
|
}
|
||||||
|
}
|
||||||
78
backend/app/Admin/Controllers/PermissionManagementController.php
Executable file
78
backend/app/Admin/Controllers/PermissionManagementController.php
Executable file
@@ -0,0 +1,78 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Admin\Requests\PermissionManagement\StoreRequest;
|
||||||
|
use App\Admin\Requests\PermissionManagement\UpdateRequest;
|
||||||
|
use App\Facades\DataTable\DataTableFacade;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Traits\ApiResponse;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Spatie\Permission\Models\Permission;
|
||||||
|
|
||||||
|
class PermissionManagementController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
use ApiResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
return response()->json(
|
||||||
|
DataTableFacade::run(
|
||||||
|
Permission::query(),
|
||||||
|
$request,
|
||||||
|
allowedFilters: ['*'],
|
||||||
|
allowedSortings: ['*']
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(StoreRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
Permission::create([
|
||||||
|
'name' => $request->name,
|
||||||
|
'guard_name' => 'web',
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $this->successResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified resource.
|
||||||
|
*/
|
||||||
|
public function show(Permission $permission): JsonResponse
|
||||||
|
{
|
||||||
|
return $this->successResponse($permission);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(UpdateRequest $request, Permission $permission): JsonResponse
|
||||||
|
{
|
||||||
|
$permission->update([
|
||||||
|
'name' => $request->name,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $this->successResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy(Permission $permission): JsonResponse
|
||||||
|
{
|
||||||
|
$permission->delete();
|
||||||
|
|
||||||
|
return $this->successResponse();
|
||||||
|
}
|
||||||
|
}
|
||||||
56
backend/app/Admin/Controllers/ProfileController.php
Executable file
56
backend/app/Admin/Controllers/ProfileController.php
Executable file
@@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Admin\Requests\Profile\ChangePasswordRequest;
|
||||||
|
use App\Admin\Requests\Profile\EditRequest;
|
||||||
|
use App\Admin\Resources\ExpertResource;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Traits\ApiResponse;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
|
||||||
|
class ProfileController extends Controller
|
||||||
|
{
|
||||||
|
use ApiResponse;
|
||||||
|
|
||||||
|
public function info(): JsonResponse
|
||||||
|
{
|
||||||
|
return $this->successResponse(new ExpertResource(Auth::guard('expert')->user()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit(EditRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
$expert = $request->user('expert');
|
||||||
|
|
||||||
|
$expert->update([
|
||||||
|
'username' => $request->username,
|
||||||
|
'first_name' => $request->first_name,
|
||||||
|
'last_name' => $request->last_name,
|
||||||
|
'email' => $expert->email,
|
||||||
|
'national_id' => $request->national_id,
|
||||||
|
'phone_number' => $request->phone_number,
|
||||||
|
'province_id' => $request->province_id,
|
||||||
|
'city_id' => $request->city_id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $this->successResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function changePassword(ChangePasswordRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
$expert = Auth::guard('expert')->user();
|
||||||
|
|
||||||
|
if (! Hash::check($request->current_password, $expert->password))
|
||||||
|
{
|
||||||
|
return $this->errorResponse(__('messages.incorrect_current_password'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$expert->update([
|
||||||
|
'password' => Hash::make($request->new_password)
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $this->successResponse();
|
||||||
|
}
|
||||||
|
}
|
||||||
77
backend/app/Admin/Controllers/RoleManagementController.php
Executable file
77
backend/app/Admin/Controllers/RoleManagementController.php
Executable file
@@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Admin\Requests\RoleManagement\StoreRequest;
|
||||||
|
use App\Admin\Requests\RoleManagement\UpdateRequest;
|
||||||
|
use App\Facades\DataTable\DataTableFacade;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Traits\ApiResponse;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Spatie\Permission\Models\Role;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
class RoleManagementController extends Controller
|
||||||
|
{
|
||||||
|
use ApiResponse;
|
||||||
|
|
||||||
|
public function index(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$data = DataTableFacade::run(
|
||||||
|
Role::query(),
|
||||||
|
$request,
|
||||||
|
allowedFilters: ['*'],
|
||||||
|
allowedSortings: ['*'],
|
||||||
|
allowedSelects: ['id', 'name']
|
||||||
|
);
|
||||||
|
|
||||||
|
return response()->json($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws Throwable
|
||||||
|
*/
|
||||||
|
public function store(StoreRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
DB::transaction(function () use ($request) {
|
||||||
|
$role = Role::create([
|
||||||
|
'name' => $request->name,
|
||||||
|
'guard_name' => 'web',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$role->givePermissionTo($request->permissions);
|
||||||
|
});
|
||||||
|
|
||||||
|
return $this->successResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws Throwable
|
||||||
|
*/
|
||||||
|
public function update(UpdateRequest $request, Role $role): JsonResponse
|
||||||
|
{
|
||||||
|
DB::transaction(function () use ($request, $role) {
|
||||||
|
$role->update([
|
||||||
|
'name' => $request->name,
|
||||||
|
'guard_name' => 'web',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$role->syncPermissions($request->permissions);
|
||||||
|
});
|
||||||
|
|
||||||
|
return $this->successResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show(Role $role): JsonResponse
|
||||||
|
{
|
||||||
|
return $this->successResponse($role);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(Role $role): JsonResponse
|
||||||
|
{
|
||||||
|
$role->delete();
|
||||||
|
return $this->successResponse();
|
||||||
|
}
|
||||||
|
}
|
||||||
113
backend/app/Admin/Controllers/UserManagementController.php
Executable file
113
backend/app/Admin/Controllers/UserManagementController.php
Executable file
@@ -0,0 +1,113 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Admin\Requests\UserManagement\StoreRequest;
|
||||||
|
use App\Admin\Requests\UserManagement\UpdateRequest;
|
||||||
|
use App\Facades\DataTable\DataTableFacade;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\City;
|
||||||
|
use App\Models\Province;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Traits\ApiResponse;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
class UserManagementController extends Controller
|
||||||
|
{
|
||||||
|
use ApiResponse;
|
||||||
|
|
||||||
|
public function index(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$data = DataTableFacade::run(
|
||||||
|
User::query(),
|
||||||
|
$request,
|
||||||
|
allowedFilters: ['*'],
|
||||||
|
allowedSortings: ['*'],
|
||||||
|
allowedSelects: ['id', 'username','first_name', 'last_name','kyc_status','national_id',
|
||||||
|
'phone_number','postal_code','province_id','province_name', 'city_id', 'city_name',
|
||||||
|
'birth_date','tax_id', 'password', 'email'],
|
||||||
|
);
|
||||||
|
|
||||||
|
return response()->json($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(StoreRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
$province = Province::query()->find($request->province_id);
|
||||||
|
$city = City::query()->find($request->city_id);
|
||||||
|
|
||||||
|
User::query()->create([
|
||||||
|
'username' => $request->username,
|
||||||
|
'first_name' => $request->first_name,
|
||||||
|
'last_name' => $request->last_name,
|
||||||
|
'national_id' => $request->national_id,
|
||||||
|
'password' => Hash::make($request->password),
|
||||||
|
'email' => $request->email,
|
||||||
|
'birth_date' => $request->birth_date,
|
||||||
|
'phone_number' => $request->phone_number,
|
||||||
|
'postal_code' => $request->postal_code,
|
||||||
|
'address' => $request->address,
|
||||||
|
'province_id' => $request->province_id,
|
||||||
|
'province_name' => $province->name,
|
||||||
|
'city_id' => $request->city_id,
|
||||||
|
'city_name' => $city->name,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $this->successResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified resource.
|
||||||
|
*/
|
||||||
|
public function show(User $user): JsonResponse
|
||||||
|
{
|
||||||
|
return $this->successResponse($user);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(UpdateRequest $request, User $user): JsonResponse
|
||||||
|
{
|
||||||
|
$province = Province::query()->find($request->province_id);
|
||||||
|
$city = City::query()->find($request->city_id);
|
||||||
|
|
||||||
|
$user->update([
|
||||||
|
'first_name' => $request->first_name,
|
||||||
|
'username' => $request->username,
|
||||||
|
'last_name' => $request->last_name,
|
||||||
|
'national_id' => $request->national_id,
|
||||||
|
'password' => Hash::make($request->password),
|
||||||
|
'email' => $request->email,
|
||||||
|
'birth_date' => $request->birth_date,
|
||||||
|
'phone_number' => $request->phone_number,
|
||||||
|
'postal_code' => $request->postal_code,
|
||||||
|
'address' => $request->address,
|
||||||
|
'province_id' => $request->province_id,
|
||||||
|
'province_name' => $province->name,
|
||||||
|
'city_id' => $request->city_id,
|
||||||
|
'city_name' => $city->name,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $this->successResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
* @throws Throwable
|
||||||
|
*/
|
||||||
|
public function destroy(User $user): JsonResponse
|
||||||
|
{
|
||||||
|
$user->delete();
|
||||||
|
|
||||||
|
return $this->successResponse();
|
||||||
|
}
|
||||||
|
}
|
||||||
30
backend/app/Admin/Requests/Auth/LoginRequest.php
Executable file
30
backend/app/Admin/Requests/Auth/LoginRequest.php
Executable file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Requests\Auth;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class LoginRequest 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 [
|
||||||
|
'login' => 'required|string',
|
||||||
|
'password' => 'required|string',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
31
backend/app/Admin/Requests/Auth/RegisterRequest.php
Executable file
31
backend/app/Admin/Requests/Auth/RegisterRequest.php
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Requests\Auth;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class RegisterRequest 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 [
|
||||||
|
'username' => 'required|unique:experts,username',
|
||||||
|
'email' => 'required|email|unique:experts,email',
|
||||||
|
'password' => 'required|string|regex:/^(?=.*[a-zA-Z])(?=.*\d).+$/|min:6|confirmed',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
29
backend/app/Admin/Requests/Documentation/RejectRequest.php
Executable file
29
backend/app/Admin/Requests/Documentation/RejectRequest.php
Executable file
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Requests\Documentation;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class RejectRequest 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 [
|
||||||
|
'kyc_reject_reason' => 'required|string',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
37
backend/app/Admin/Requests/ExpertManagement/StoreRequest.php
Executable file
37
backend/app/Admin/Requests/ExpertManagement/StoreRequest.php
Executable file
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Requests\ExpertManagement;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
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, ValidationRule|array|string>
|
||||||
|
*/
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'username' => 'required|string|max:255|unique:experts,username',
|
||||||
|
'first_name' => 'required|string|max:255',
|
||||||
|
'last_name' => 'required|string|max:255',
|
||||||
|
'national_id' => 'required|string|max:20|unique:experts,national_id',
|
||||||
|
'password' => 'required|string|min:8|confirmed',
|
||||||
|
'email' => 'required|email|max:255|unique:experts,email',
|
||||||
|
'phone_number' => 'required|string|max:20|unique:experts,phone_number',
|
||||||
|
'province_id' => 'required|integer|exists:provinces,id',
|
||||||
|
'city_id' => 'required|integer|exists:cities,id',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
45
backend/app/Admin/Requests/ExpertManagement/UpdateRequest.php
Executable file
45
backend/app/Admin/Requests/ExpertManagement/UpdateRequest.php
Executable file
@@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Requests\ExpertManagement;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property mixed $expert
|
||||||
|
*/
|
||||||
|
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, ValidationRule|array|string>
|
||||||
|
*/
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'username' => ['string', 'max:255',
|
||||||
|
Rule::unique('experts', 'username')->ignore($this->expert->id),],
|
||||||
|
'first_name' => 'string|max:255',
|
||||||
|
'last_name' => 'string|max:255',
|
||||||
|
'national_id' => ['string', 'max:20',
|
||||||
|
Rule::unique('experts', 'national_id')->ignore($this->expert->id),],
|
||||||
|
'password' => 'string|min:8|confirmed',
|
||||||
|
'email' => ['email', 'max:255',
|
||||||
|
Rule::unique('experts', 'email')->ignore($this->expert->id),],
|
||||||
|
'phone_number' => ['string', 'max:20',
|
||||||
|
Rule::unique('experts', 'phone_number')->ignore($this->expert->id),],
|
||||||
|
'province_id' => 'required|integer|exists:provinces,id',
|
||||||
|
'city_id' => 'required|integer|exists:cities,id',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
29
backend/app/Admin/Requests/PermissionManagement/StoreRequest.php
Executable file
29
backend/app/Admin/Requests/PermissionManagement/StoreRequest.php
Executable file
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Requests\PermissionManagement;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
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, ValidationRule|array|string>
|
||||||
|
*/
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => 'required|string|unique:permissions,name',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
33
backend/app/Admin/Requests/PermissionManagement/UpdateRequest.php
Executable file
33
backend/app/Admin/Requests/PermissionManagement/UpdateRequest.php
Executable file
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Requests\PermissionManagement;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property mixed $permission
|
||||||
|
*/
|
||||||
|
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, ValidationRule|array|string>
|
||||||
|
*/
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => ['required', 'string', 'max:255', Rule::unique('permissions', 'name')->ignore($this->permission->id)],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
30
backend/app/Admin/Requests/Profile/ChangePasswordRequest.php
Executable file
30
backend/app/Admin/Requests/Profile/ChangePasswordRequest.php
Executable file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Requests\Profile;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class ChangePasswordRequest 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 [
|
||||||
|
'current_password' => 'required|string|regex:/^(?=.*[a-zA-Z])(?=.*\d).+$/|min:8',
|
||||||
|
'new_password' => 'required|string|regex:/^(?=.*[a-zA-Z])(?=.*\d).+$/|min:8',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
38
backend/app/Admin/Requests/Profile/EditRequest.php
Executable file
38
backend/app/Admin/Requests/Profile/EditRequest.php
Executable file
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Requests\Profile;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
use Illuminate\Validation\Validator;
|
||||||
|
|
||||||
|
class EditRequest 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 [
|
||||||
|
'username' => 'string|max:255',
|
||||||
|
'first_name' => 'required|string',
|
||||||
|
'last_name' => 'required|string',
|
||||||
|
'national_id' => 'required',
|
||||||
|
'email' => 'string|email|max:255',
|
||||||
|
'phone_number' => 'string',
|
||||||
|
'province_id' => 'string',
|
||||||
|
'city_id' => 'string',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
31
backend/app/Admin/Requests/RoleManagement/StoreRequest.php
Executable file
31
backend/app/Admin/Requests/RoleManagement/StoreRequest.php
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Requests\RoleManagement;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
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, ValidationRule|array|string>
|
||||||
|
*/
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => 'required|string|unique:roles,name',
|
||||||
|
'permissions' => 'array',
|
||||||
|
'permissions.*' => 'integer|exists:permissions,id',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
35
backend/app/Admin/Requests/RoleManagement/UpdateRequest.php
Executable file
35
backend/app/Admin/Requests/RoleManagement/UpdateRequest.php
Executable file
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Requests\RoleManagement;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property mixed $role
|
||||||
|
*/
|
||||||
|
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, ValidationRule|array|string>
|
||||||
|
*/
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => ['string', 'max:255', Rule::unique('roles', 'name')->ignore($this->role->id)],
|
||||||
|
'permissions' => 'array',
|
||||||
|
'permissions.*' => 'integer|exists:permissions,id',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
40
backend/app/Admin/Requests/UserManagement/StoreRequest.php
Executable file
40
backend/app/Admin/Requests/UserManagement/StoreRequest.php
Executable file
@@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Requests\UserManagement;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
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, ValidationRule|array|string>
|
||||||
|
*/
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'username' => 'required|string|max:255|unique:users,username',
|
||||||
|
'first_name' => 'required|string|max:255',
|
||||||
|
'last_name' => 'required|string|max:255',
|
||||||
|
'national_id' => 'required|string|max:20|unique:users,national_id',
|
||||||
|
'password' => 'required|string|min:6|confirmed',
|
||||||
|
'email' => 'required|email|max:255|unique:users,email',
|
||||||
|
'birth_date' => 'nullable|date',
|
||||||
|
'phone_number' => 'required|string|max:20|unique:users,phone_number',
|
||||||
|
'postal_code' => 'nullable|string|max:20',
|
||||||
|
'address' => 'nullable|string|max:1000',
|
||||||
|
'province_id' => 'required|integer|exists:provinces,id',
|
||||||
|
'city_id' => 'required|integer|exists:cities,id',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
49
backend/app/Admin/Requests/UserManagement/UpdateRequest.php
Executable file
49
backend/app/Admin/Requests/UserManagement/UpdateRequest.php
Executable file
@@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Requests\UserManagement;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property mixed $user
|
||||||
|
*/
|
||||||
|
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, ValidationRule|array|string>
|
||||||
|
*/
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
|
||||||
|
return [
|
||||||
|
'username' => ['string', 'max:255',
|
||||||
|
Rule::unique('users', 'username')->ignore($this->user->id),],
|
||||||
|
'first_name' => 'string|max:255',
|
||||||
|
'last_name' => 'string|max:255',
|
||||||
|
'national_id' => ['string', 'max:20',
|
||||||
|
Rule::unique('users', 'national_id')->ignore($this->user->id),],
|
||||||
|
'password' => 'string|min:8|confirmed',
|
||||||
|
'email' => ['email', 'max:255',
|
||||||
|
Rule::unique('users', 'email')->ignore($this->user->id),],
|
||||||
|
'birth_date' => 'nullable|date',
|
||||||
|
'phone_number' => ['string', 'max:20',
|
||||||
|
Rule::unique('users', 'phone_number')->ignore($this->user->id),],
|
||||||
|
'postal_code' => 'nullable|string|max:20',
|
||||||
|
'address' => 'nullable|string|max:1000',
|
||||||
|
'province_id' => 'integer|exists:provinces,id',
|
||||||
|
'city_id' => 'integer|exists:cities,id',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
24
backend/app/Admin/Resources/ExpertResource.php
Executable file
24
backend/app/Admin/Resources/ExpertResource.php
Executable file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Resources;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
|
class ExpertResource extends JsonResource
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Transform the resource into an array.
|
||||||
|
*
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function toArray(Request $request): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => $this->id,
|
||||||
|
'username' => $this->username,
|
||||||
|
'email' => $this->email,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
66
backend/app/Enums/BusinessTypeEnum.php
Normal file
66
backend/app/Enums/BusinessTypeEnum.php
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Enums;
|
||||||
|
|
||||||
|
enum BusinessTypeEnum: int
|
||||||
|
{
|
||||||
|
case MEDICAL = 1;
|
||||||
|
case LEGAL = 2;
|
||||||
|
case ENGINEERING = 3;
|
||||||
|
case EDUCATION = 4;
|
||||||
|
case CONSULTING = 5;
|
||||||
|
case BEAUTY = 6;
|
||||||
|
case TECHNICAL_SERVICES = 7;
|
||||||
|
case FINANCIAL = 8;
|
||||||
|
case REAL_ESTATE = 9;
|
||||||
|
case RESTAURANT = 10;
|
||||||
|
case SHOP = 11;
|
||||||
|
case TRANSPORTATION = 12;
|
||||||
|
case ART = 13;
|
||||||
|
case SPORT = 14;
|
||||||
|
case OTHER = 15;
|
||||||
|
|
||||||
|
public function label(): string
|
||||||
|
{
|
||||||
|
return match ($this) {
|
||||||
|
self::MEDICAL => 'medical',
|
||||||
|
self::LEGAL => 'legal',
|
||||||
|
self::ENGINEERING => 'engineering',
|
||||||
|
self::EDUCATION => 'education',
|
||||||
|
self::CONSULTING => 'consulting',
|
||||||
|
self::BEAUTY => 'beauty',
|
||||||
|
self::TECHNICAL_SERVICES => 'technical_services',
|
||||||
|
self::FINANCIAL => 'financial',
|
||||||
|
self::REAL_ESTATE => 'real_estate',
|
||||||
|
self::RESTAURANT => 'restaurant',
|
||||||
|
self::SHOP => 'shop',
|
||||||
|
self::TRANSPORTATION => 'transportation',
|
||||||
|
self::ART => 'art',
|
||||||
|
self::SPORT => 'sport',
|
||||||
|
self::OTHER => 'other',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function name($id): string
|
||||||
|
{
|
||||||
|
$mapArray = [
|
||||||
|
1 => 'medical',
|
||||||
|
2 => 'legal',
|
||||||
|
3 => 'engineering',
|
||||||
|
4 => 'education',
|
||||||
|
5 => 'consulting',
|
||||||
|
6 => 'beauty',
|
||||||
|
7 => 'technical_services',
|
||||||
|
8 => 'financial',
|
||||||
|
9 => 'real_estate',
|
||||||
|
10 => 'restaurant',
|
||||||
|
11 => 'shop',
|
||||||
|
12 => 'transportation',
|
||||||
|
13 => 'art',
|
||||||
|
14 => 'sport',
|
||||||
|
15 => 'other',
|
||||||
|
];
|
||||||
|
|
||||||
|
return $mapArray[$id];
|
||||||
|
}
|
||||||
|
}
|
||||||
23
backend/app/Enums/PaymentStatusEnum.php
Normal file
23
backend/app/Enums/PaymentStatusEnum.php
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Enums;
|
||||||
|
|
||||||
|
enum PaymentStatusEnum:int
|
||||||
|
{
|
||||||
|
case Unpaid = 0;
|
||||||
|
case Cancelled = 1;
|
||||||
|
case Expired = 2;
|
||||||
|
case Paid = 3;
|
||||||
|
case Refunded = 4;
|
||||||
|
|
||||||
|
public function label(): string
|
||||||
|
{
|
||||||
|
return match ($this) {
|
||||||
|
self::Unpaid => 'unpaid',
|
||||||
|
self::Cancelled => 'cancelled',
|
||||||
|
self::Expired => 'expired',
|
||||||
|
self::Paid => 'paid',
|
||||||
|
self::Refunded => 'refunded',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
0
backend/app/Facades/DataTable/DataTable.php
Normal file → Executable file
0
backend/app/Facades/DataTable/DataTable.php
Normal file → Executable file
0
backend/app/Facades/DataTable/DataTableFacade.php
Normal file → Executable file
0
backend/app/Facades/DataTable/DataTableFacade.php
Normal file → Executable file
0
backend/app/Facades/File/File.php
Normal file → Executable file
0
backend/app/Facades/File/File.php
Normal file → Executable file
0
backend/app/Facades/File/FileFacade.php
Normal file → Executable file
0
backend/app/Facades/File/FileFacade.php
Normal file → Executable file
0
backend/app/Http/Controllers/Controller.php
Normal file → Executable file
0
backend/app/Http/Controllers/Controller.php
Normal file → Executable file
40
backend/app/Mail/LoginNotificationMail.php
Executable file
40
backend/app/Mail/LoginNotificationMail.php
Executable file
@@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Mail;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Mail\Mailable;
|
||||||
|
use Illuminate\Mail\Mailables\Content;
|
||||||
|
use Illuminate\Mail\Mailables\Envelope;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
class LoginNotificationMail extends Mailable
|
||||||
|
{
|
||||||
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
public User $user
|
||||||
|
) {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
public function envelope(): Envelope
|
||||||
|
{
|
||||||
|
return new Envelope(
|
||||||
|
subject: 'Login Notification Mail',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function content(): Content
|
||||||
|
{
|
||||||
|
return new Content(
|
||||||
|
view: 'emails.login-notification',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function attachments(): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
15
backend/app/Models/BusinessType.php
Normal file
15
backend/app/Models/BusinessType.php
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Database\Factories\BusinessTypeFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class BusinessType extends Model
|
||||||
|
{
|
||||||
|
/** @use HasFactory<BusinessTypeFactory> */
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $guarded = ['id'];
|
||||||
|
}
|
||||||
15
backend/app/Models/City.php
Executable file
15
backend/app/Models/City.php
Executable file
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Database\Factories\CityFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class City extends Model
|
||||||
|
{
|
||||||
|
/** @use HasFactory<CityFactory> */
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $guarded = ['id'];
|
||||||
|
}
|
||||||
30
backend/app/Models/Document.php
Executable file
30
backend/app/Models/Document.php
Executable file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Database\Factories\DocumentFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||||
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
|
class Document extends Model
|
||||||
|
{
|
||||||
|
/** @use HasFactory<DocumentFactory> */
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $guarded = ['id'];
|
||||||
|
|
||||||
|
public function documentable(): MorphTo
|
||||||
|
{
|
||||||
|
return $this->morphTo();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function url(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn($value) => Storage::disk('public')->url($value)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
24
backend/app/Models/Expert.php
Executable file
24
backend/app/Models/Expert.php
Executable file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Database\Factories\ExpertFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Notifications\Notifiable;
|
||||||
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
|
use Spatie\Permission\Traits\HasRoles;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @method roles()
|
||||||
|
* @method permissions()
|
||||||
|
*/
|
||||||
|
class Expert extends Authenticatable
|
||||||
|
{
|
||||||
|
/** @use HasFactory<ExpertFactory> */
|
||||||
|
|
||||||
|
use Notifiable,HasFactory,HasRoles;
|
||||||
|
|
||||||
|
protected $guarded = ['id'];
|
||||||
|
protected string $guard_name = 'web';
|
||||||
|
}
|
||||||
12
backend/app/Models/FibTransaction.php
Normal file
12
backend/app/Models/FibTransaction.php
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class FibTransaction extends Model
|
||||||
|
{
|
||||||
|
/** @use HasFactory<\Database\Factories\FibTransactionFactory> */
|
||||||
|
use HasFactory;
|
||||||
|
}
|
||||||
12
backend/app/Models/FibTransactionStatus.php
Normal file
12
backend/app/Models/FibTransactionStatus.php
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class FibTransactionStatus extends Model
|
||||||
|
{
|
||||||
|
/** @use HasFactory<\Database\Factories\FibTransactionStatusFactory> */
|
||||||
|
use HasFactory;
|
||||||
|
}
|
||||||
15
backend/app/Models/Payment.php
Normal file
15
backend/app/Models/Payment.php
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Database\Factories\PaymentFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Payment extends Model
|
||||||
|
{
|
||||||
|
/** @use HasFactory<PaymentFactory> */
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $guarded = ['id'];
|
||||||
|
}
|
||||||
15
backend/app/Models/PaymentStatus.php
Normal file
15
backend/app/Models/PaymentStatus.php
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Database\Factories\PaymentStatusFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class PaymentStatus extends Model
|
||||||
|
{
|
||||||
|
/** @use HasFactory<PaymentStatusFactory> */
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $guarded = ['id'];
|
||||||
|
}
|
||||||
15
backend/app/Models/Province.php
Executable file
15
backend/app/Models/Province.php
Executable file
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Database\Factories\ProvinceFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Province extends Model
|
||||||
|
{
|
||||||
|
/** @use HasFactory<ProvinceFactory> */
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $guarded = ['id'];
|
||||||
|
}
|
||||||
15
backend/app/Models/Transaction.php
Normal file
15
backend/app/Models/Transaction.php
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Database\Factories\TransactionFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Transaction extends Model
|
||||||
|
{
|
||||||
|
/** @use HasFactory<TransactionFactory> */
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $guarded = ['id'];
|
||||||
|
}
|
||||||
32
backend/app/Models/User.php
Normal file → Executable file
32
backend/app/Models/User.php
Normal file → Executable file
@@ -4,30 +4,36 @@ namespace App\Models;
|
|||||||
|
|
||||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||||
use Database\Factories\UserFactory;
|
use Database\Factories\UserFactory;
|
||||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
use Illuminate\Database\Eloquent\Attributes\Guarded;
|
||||||
use Illuminate\Database\Eloquent\Attributes\Hidden;
|
use Illuminate\Database\Eloquent\Attributes\Hidden;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\MorphToMany;
|
||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
use Illuminate\Notifications\Notifiable;
|
use Illuminate\Notifications\Notifiable;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Laravel\Passport\Bridge\Client;
|
||||||
use Laravel\Passport\HasApiTokens;
|
use Laravel\Passport\HasApiTokens;
|
||||||
|
|
||||||
#[Fillable(['name', 'email', 'password'])]
|
#[Guarded(['id'])]
|
||||||
#[Hidden(['password', 'remember_token'])]
|
#[Hidden(['password'])]
|
||||||
class User extends Authenticatable
|
class User extends Authenticatable
|
||||||
{
|
{
|
||||||
/** @use HasFactory<UserFactory> */
|
/** @use HasFactory<UserFactory> */
|
||||||
use HasFactory, Notifiable, HasApiTokens;
|
use HasFactory, Notifiable, HasApiTokens;
|
||||||
|
protected $guarded = ['id'];
|
||||||
|
|
||||||
/**
|
public function documents(): MorphToMany
|
||||||
* Get the attributes that should be cast.
|
|
||||||
*
|
|
||||||
* @return array<string, string>
|
|
||||||
*/
|
|
||||||
protected function casts(): array
|
|
||||||
{
|
{
|
||||||
return [
|
return $this->morphToMany(Document::class, 'documentable');
|
||||||
'email_verified_at' => 'datetime',
|
}
|
||||||
'password' => 'hashed',
|
|
||||||
];
|
public function validateForPassportPasswordGrant(string $password): bool
|
||||||
|
{
|
||||||
|
return Hash::check($password, $this->password);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findForPassport(string $username, Client $client): User
|
||||||
|
{
|
||||||
|
return $this->where('username', $username)->first();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
15
backend/app/Models/UserGateway.php
Normal file
15
backend/app/Models/UserGateway.php
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Database\Factories\UserGatewayFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class UserGateway extends Model
|
||||||
|
{
|
||||||
|
/** @use HasFactory<UserGatewayFactory> */
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $guarded = ['id'];
|
||||||
|
}
|
||||||
4
backend/app/Providers/AppServiceProvider.php
Normal file → Executable file
4
backend/app/Providers/AppServiceProvider.php
Normal file → Executable file
@@ -4,6 +4,7 @@ namespace App\Providers;
|
|||||||
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Laravel\Passport\Passport;
|
use Laravel\Passport\Passport;
|
||||||
|
use Carbon\CarbonInterval;
|
||||||
|
|
||||||
class AppServiceProvider extends ServiceProvider
|
class AppServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
@@ -21,5 +22,8 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
public function boot(): void
|
public function boot(): void
|
||||||
{
|
{
|
||||||
Passport::enablePasswordGrant();
|
Passport::enablePasswordGrant();
|
||||||
|
Passport::tokensExpireIn(CarbonInterval::minutes(1));
|
||||||
|
Passport::refreshTokensExpireIn(CarbonInterval::minutes(5));
|
||||||
|
Passport::personalAccessTokensExpireIn(CarbonInterval::minutes(1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
0
backend/app/Providers/DataTableServiceProvider.php
Normal file → Executable file
0
backend/app/Providers/DataTableServiceProvider.php
Normal file → Executable file
0
backend/app/Providers/FileServiceProvider.php
Normal file → Executable file
0
backend/app/Providers/FileServiceProvider.php
Normal file → Executable file
0
backend/app/Services/DataTable/DataTableInput.php
Normal file → Executable file
0
backend/app/Services/DataTable/DataTableInput.php
Normal file → Executable file
0
backend/app/Services/DataTable/DataTableService.php
Normal file → Executable file
0
backend/app/Services/DataTable/DataTableService.php
Normal file → Executable file
0
backend/app/Services/DataTable/Enums/DataType.php
Normal file → Executable file
0
backend/app/Services/DataTable/Enums/DataType.php
Normal file → Executable file
0
backend/app/Services/DataTable/Enums/SearchType.php
Normal file → Executable file
0
backend/app/Services/DataTable/Enums/SearchType.php
Normal file → Executable file
0
backend/app/Services/DataTable/Exceptions/InvalidFilterException.php
Normal file → Executable file
0
backend/app/Services/DataTable/Exceptions/InvalidFilterException.php
Normal file → Executable file
0
backend/app/Services/DataTable/Exceptions/InvalidParameterInterface.php
Normal file → Executable file
0
backend/app/Services/DataTable/Exceptions/InvalidParameterInterface.php
Normal file → Executable file
0
backend/app/Services/DataTable/Exceptions/InvalidRelationException.php
Normal file → Executable file
0
backend/app/Services/DataTable/Exceptions/InvalidRelationException.php
Normal file → Executable file
0
backend/app/Services/DataTable/Exceptions/InvalidSortingException.php
Normal file → Executable file
0
backend/app/Services/DataTable/Exceptions/InvalidSortingException.php
Normal file → Executable file
0
backend/app/Services/DataTable/Filter/ApplyFilter.php
Normal file → Executable file
0
backend/app/Services/DataTable/Filter/ApplyFilter.php
Normal file → Executable file
0
backend/app/Services/DataTable/Filter/Filter.php
Normal file → Executable file
0
backend/app/Services/DataTable/Filter/Filter.php
Normal file → Executable file
0
backend/app/Services/DataTable/Filter/SearchFunctions/FilterBetween.php
Normal file → Executable file
0
backend/app/Services/DataTable/Filter/SearchFunctions/FilterBetween.php
Normal file → Executable file
0
backend/app/Services/DataTable/Filter/SearchFunctions/FilterContains.php
Normal file → Executable file
0
backend/app/Services/DataTable/Filter/SearchFunctions/FilterContains.php
Normal file → Executable file
0
backend/app/Services/DataTable/Filter/SearchFunctions/FilterEquals.php
Normal file → Executable file
0
backend/app/Services/DataTable/Filter/SearchFunctions/FilterEquals.php
Normal file → Executable file
0
backend/app/Services/DataTable/Filter/SearchFunctions/FilterGreaterThan.php
Normal file → Executable file
0
backend/app/Services/DataTable/Filter/SearchFunctions/FilterGreaterThan.php
Normal file → Executable file
0
backend/app/Services/DataTable/Filter/SearchFunctions/FilterGreaterThanOrEqual.php
Normal file → Executable file
0
backend/app/Services/DataTable/Filter/SearchFunctions/FilterGreaterThanOrEqual.php
Normal file → Executable file
0
backend/app/Services/DataTable/Filter/SearchFunctions/FilterLessThan.php
Normal file → Executable file
0
backend/app/Services/DataTable/Filter/SearchFunctions/FilterLessThan.php
Normal file → Executable file
0
backend/app/Services/DataTable/Filter/SearchFunctions/FilterLessThanOrEqual.php
Normal file → Executable file
0
backend/app/Services/DataTable/Filter/SearchFunctions/FilterLessThanOrEqual.php
Normal file → Executable file
0
backend/app/Services/DataTable/Filter/SearchFunctions/FilterNotEquals.php
Normal file → Executable file
0
backend/app/Services/DataTable/Filter/SearchFunctions/FilterNotEquals.php
Normal file → Executable file
0
backend/app/Services/DataTable/Filter/SearchFunctions/SearchFilter.php
Normal file → Executable file
0
backend/app/Services/DataTable/Filter/SearchFunctions/SearchFilter.php
Normal file → Executable file
0
backend/app/Services/DataTable/Sort/ApplySort.php
Normal file → Executable file
0
backend/app/Services/DataTable/Sort/ApplySort.php
Normal file → Executable file
0
backend/app/Services/DataTable/Sort/Sort.php
Normal file → Executable file
0
backend/app/Services/DataTable/Sort/Sort.php
Normal file → Executable file
0
backend/app/Services/DataTable/Validators/FilterValidator.php
Normal file → Executable file
0
backend/app/Services/DataTable/Validators/FilterValidator.php
Normal file → Executable file
0
backend/app/Services/DataTable/Validators/RelationValidator.php
Normal file → Executable file
0
backend/app/Services/DataTable/Validators/RelationValidator.php
Normal file → Executable file
0
backend/app/Services/DataTable/Validators/SortingValidator.php
Normal file → Executable file
0
backend/app/Services/DataTable/Validators/SortingValidator.php
Normal file → Executable file
5
backend/app/User/Services/FIB/AuthorizationService.php → backend/app/Services/FIB/AuthorizationService.php
Normal file → Executable file
5
backend/app/User/Services/FIB/AuthorizationService.php → backend/app/Services/FIB/AuthorizationService.php
Normal file → Executable file
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\User\Services\FIB;
|
namespace App\Services\FIB;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Illuminate\Http\Client\ConnectionException;
|
use Illuminate\Http\Client\ConnectionException;
|
||||||
@@ -16,7 +16,7 @@ class AuthorizationService
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->url = config('fib.authorization.url');
|
$this->url = config('fib.authorization.url');
|
||||||
$this->channelName = '';
|
$this->channelName = 'fib_authorization';
|
||||||
$this->inputParameters = [
|
$this->inputParameters = [
|
||||||
'client_id' => config('fib.authorization.client_id'),
|
'client_id' => config('fib.authorization.client_id'),
|
||||||
'client_secret' => config('fib.authorization.client_secret'),
|
'client_secret' => config('fib.authorization.client_secret'),
|
||||||
@@ -51,7 +51,6 @@ class AuthorizationService
|
|||||||
{
|
{
|
||||||
return Http::asForm()
|
return Http::asForm()
|
||||||
->throw()
|
->throw()
|
||||||
->withoutVerifying()
|
|
||||||
->post($this->url, $this->inputParameters)
|
->post($this->url, $this->inputParameters)
|
||||||
->json();
|
->json();
|
||||||
}
|
}
|
||||||
2
backend/app/User/Services/FIB/CancelPaymentService.php → backend/app/Services/FIB/CancelPaymentService.php
Normal file → Executable file
2
backend/app/User/Services/FIB/CancelPaymentService.php → backend/app/Services/FIB/CancelPaymentService.php
Normal file → Executable file
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\User\Services\FIB;
|
namespace App\Services\FIB;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Illuminate\Http\Client\ConnectionException;
|
use Illuminate\Http\Client\ConnectionException;
|
||||||
2
backend/app/User/Services/FIB/CheckPaymentStatusService.php → backend/app/Services/FIB/CheckPaymentStatusService.php
Normal file → Executable file
2
backend/app/User/Services/FIB/CheckPaymentStatusService.php → backend/app/Services/FIB/CheckPaymentStatusService.php
Normal file → Executable file
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\User\Services\FIB;
|
namespace App\Services\FIB;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Illuminate\Http\Client\ConnectionException;
|
use Illuminate\Http\Client\ConnectionException;
|
||||||
2
backend/app/User/Services/FIB/CreatePaymentService.php → backend/app/Services/FIB/CreatePaymentService.php
Normal file → Executable file
2
backend/app/User/Services/FIB/CreatePaymentService.php → backend/app/Services/FIB/CreatePaymentService.php
Normal file → Executable file
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\User\Services\FIB;
|
namespace App\Services\FIB;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Illuminate\Http\Client\ConnectionException;
|
use Illuminate\Http\Client\ConnectionException;
|
||||||
2
backend/app/User/Services/FIB/RefundService.php → backend/app/Services/FIB/RefundService.php
Normal file → Executable file
2
backend/app/User/Services/FIB/RefundService.php → backend/app/Services/FIB/RefundService.php
Normal file → Executable file
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\User\Services\FIB;
|
namespace App\Services\FIB;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Illuminate\Http\Client\ConnectionException;
|
use Illuminate\Http\Client\ConnectionException;
|
||||||
31
backend/app/Traits/ApiResponse.php
Executable file
31
backend/app/Traits/ApiResponse.php
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Traits;
|
||||||
|
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
|
||||||
|
trait ApiResponse
|
||||||
|
{
|
||||||
|
public function successResponse(mixed $data = null, string $message = null, int $statusCode = 200): JsonResponse
|
||||||
|
{
|
||||||
|
if (!is_null($data)) {
|
||||||
|
return response()->json([
|
||||||
|
'data' => $data
|
||||||
|
], $statusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
$message = $message ?? __('messages.successful');
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => $message
|
||||||
|
], $statusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function errorResponse(string $message, string $type = 'logical_exception', int $statusCode = 422): JsonResponse
|
||||||
|
{
|
||||||
|
return response()->json([
|
||||||
|
'type' => $type,
|
||||||
|
'message' => $message
|
||||||
|
], $statusCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
64
backend/app/User/Controllers/AuthController.php
Executable file
64
backend/app/User/Controllers/AuthController.php
Executable file
@@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Traits\ApiResponse;
|
||||||
|
use App\User\Requests\Auth\LoginRequest;
|
||||||
|
use App\User\Requests\Auth\RegisterRequest;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
|
||||||
|
class AuthController extends Controller
|
||||||
|
{
|
||||||
|
use ApiResponse;
|
||||||
|
|
||||||
|
public function register(RegisterRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
$user = User::query()->create([
|
||||||
|
'username' => $request->username,
|
||||||
|
'email' => $request->email,
|
||||||
|
'password' => Hash::make($request->password),
|
||||||
|
]);
|
||||||
|
|
||||||
|
Auth::guard('web')->login($user);
|
||||||
|
|
||||||
|
$request->session()->regenerate();
|
||||||
|
|
||||||
|
return $this->successResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function login(LoginRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
$credentials = ['password' => $request->password,];
|
||||||
|
|
||||||
|
if (filter_var($request->login, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
$credentials['email'] = $request->login;
|
||||||
|
} else {
|
||||||
|
$credentials['username'] = $request->login;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Auth::attempt($credentials))
|
||||||
|
{
|
||||||
|
$request->session()->regenerate();
|
||||||
|
|
||||||
|
return $this->successResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->errorResponse(__('messages.incorrect_or_username_password'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function logout(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
Auth::guard('web')->logout();
|
||||||
|
|
||||||
|
$request->session()->invalidate();
|
||||||
|
|
||||||
|
$request->session()->regenerateToken();
|
||||||
|
|
||||||
|
return $this->successResponse();
|
||||||
|
}
|
||||||
|
}
|
||||||
24
backend/app/User/Controllers/CityController.php
Executable file
24
backend/app/User/Controllers/CityController.php
Executable file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\City;
|
||||||
|
use App\Models\Province;
|
||||||
|
use App\Traits\ApiResponse;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class CityController extends Controller
|
||||||
|
{
|
||||||
|
use ApiResponse;
|
||||||
|
|
||||||
|
public function list(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$cities = City::query()
|
||||||
|
->where('province_id', '=', $request->query('province_id'))
|
||||||
|
->get(['id', 'name']);
|
||||||
|
|
||||||
|
return $this->successResponse($cities);
|
||||||
|
}
|
||||||
|
}
|
||||||
42
backend/app/User/Controllers/DocumentationController.php
Executable file
42
backend/app/User/Controllers/DocumentationController.php
Executable file
@@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Controllers;
|
||||||
|
|
||||||
|
use App\Facades\File\FileFacade;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Traits\ApiResponse;
|
||||||
|
use App\User\Requests\Documentation\EditRequest;
|
||||||
|
use App\User\Requests\Documentation\UploadRequest;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
class DocumentationController extends Controller
|
||||||
|
{
|
||||||
|
use ApiResponse;
|
||||||
|
|
||||||
|
public function upload(UploadRequest $request): jsonResponse
|
||||||
|
{
|
||||||
|
$user = Auth::guard('web')->user();
|
||||||
|
|
||||||
|
foreach ($request->documents as $document) {
|
||||||
|
$user->documents()->create([
|
||||||
|
'title' => $document['title'],
|
||||||
|
'url' => FileFacade::save($document['file'], "/{$user->id}/documents", $document['title']),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->successResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit(EditRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
$user = Auth::guard('web')->user();
|
||||||
|
|
||||||
|
foreach ($request->documents as $document) {
|
||||||
|
$user->documents()->sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->successResponse();
|
||||||
|
}
|
||||||
|
}
|
||||||
97
backend/app/User/Controllers/GatewayManagementController.php
Normal file
97
backend/app/User/Controllers/GatewayManagementController.php
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Controllers;
|
||||||
|
|
||||||
|
use App\Enums\BusinessTypeEnum;
|
||||||
|
use App\Facades\DataTable\DataTableFacade;
|
||||||
|
use App\Facades\File\FileFacade;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\UserGateway;
|
||||||
|
use App\Traits\ApiResponse;
|
||||||
|
use App\User\Requests\Gateway\StoreRequest;
|
||||||
|
use App\User\Requests\Gateway\UpdateRequest;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
class GatewayManagementController extends Controller
|
||||||
|
{
|
||||||
|
use ApiResponse;
|
||||||
|
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
return DataTableFacade::run(
|
||||||
|
UserGateway::query()->where('user_id', '=', Auth::guard('web')->id()),
|
||||||
|
$request,
|
||||||
|
allowedFilters: ['*'],
|
||||||
|
allowedSortings: ['*'],
|
||||||
|
allowedSelects: ['id', 'name', 'domain', 'tax_id', 'bank_name', 'account_holder', 'iban', 'business_type_id', 'business_type_name'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws Throwable
|
||||||
|
*/
|
||||||
|
public function store(StoreRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
$user = Auth::guard('web')->user();
|
||||||
|
|
||||||
|
$logo = $request->has('logo') ? FileFacade::save($request->file('logo'), "{$user->id}") : null;
|
||||||
|
|
||||||
|
DB::transaction(function () use ($user, $logo, $request) {
|
||||||
|
UserGateway::query()->create([
|
||||||
|
'user_id' => $user->id,
|
||||||
|
'username' => $user->username,
|
||||||
|
'name' => $request->name,
|
||||||
|
'domain' => $request->domain,
|
||||||
|
'tax_id' => $request->tax_id,
|
||||||
|
'bank_name' => $request->bank_name,
|
||||||
|
'account_holder' => $request->account_holder,
|
||||||
|
'iban' => $request->iban,
|
||||||
|
'business_type_id' => $request->business_type_id,
|
||||||
|
'business_type_name' => BusinessTypeEnum::name($request->business_type_id),
|
||||||
|
'logo' => $logo,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$user->update(['authority_level' => 1]);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
return $this->successResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show(UserGateway $gateway): JsonResponse
|
||||||
|
{
|
||||||
|
return $this->successResponse($gateway);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(UpdateRequest $request, UserGateway $gateway): JsonResponse
|
||||||
|
{
|
||||||
|
$logo = null;
|
||||||
|
$user = Auth::guard('web')->user();
|
||||||
|
|
||||||
|
if ($request->has('logo'))
|
||||||
|
{
|
||||||
|
FileFacade::delete($gateway->logo, true);
|
||||||
|
$logo = FileFacade::save(request()->file('logo'), "{$user->id}");
|
||||||
|
}
|
||||||
|
|
||||||
|
$gateway->update([
|
||||||
|
'name' => $request->name,
|
||||||
|
'domain' => $request->domain,
|
||||||
|
'business_type_id' => $request->business_type_id,
|
||||||
|
'business_type_name' => BusinessTypeEnum::name($request->business_type_id),
|
||||||
|
'logo' => $logo,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $this->successResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(UserGateway $gateway): JsonResponse
|
||||||
|
{
|
||||||
|
$gateway->delete();
|
||||||
|
return $this->successResponse();
|
||||||
|
}
|
||||||
|
}
|
||||||
80
backend/app/User/Controllers/ProfileController.php
Executable file
80
backend/app/User/Controllers/ProfileController.php
Executable file
@@ -0,0 +1,80 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Controllers;
|
||||||
|
|
||||||
|
use App\Facades\File\FileFacade;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\City;
|
||||||
|
use App\Models\Province;
|
||||||
|
use App\Traits\ApiResponse;
|
||||||
|
use App\User\Requests\Profile\ChangePasswordRequest;
|
||||||
|
use App\User\Requests\Profile\EditRequest;
|
||||||
|
use App\User\Resources\UserResource;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
class ProfileController extends Controller
|
||||||
|
{
|
||||||
|
use ApiResponse;
|
||||||
|
|
||||||
|
public function info(): JsonResponse
|
||||||
|
{
|
||||||
|
return $this->successResponse(new UserResource(Auth::user()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws Throwable
|
||||||
|
*/
|
||||||
|
public function edit(EditRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
$province = Province::query()->find($request->province_id);
|
||||||
|
$city = City::query()->find($request->city_id);
|
||||||
|
|
||||||
|
DB::transaction(function () use ($user, $province, $city, $request) {
|
||||||
|
if ($user->kyc_status == 0)
|
||||||
|
{
|
||||||
|
$user->documents()->create([
|
||||||
|
'title' => 'id_card',
|
||||||
|
'url' => FileFacade::save($request->file('id_card'), "{$user->id}/"),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$user->update([
|
||||||
|
'first_name' => $request->first_name,
|
||||||
|
'last_name' => $request->last_name,
|
||||||
|
'national_id' => $user->kyc_status == 0 ? $request->national_id : $user->national_id,
|
||||||
|
'address' => $request->address,
|
||||||
|
'postal_code' => $request->postal_code,
|
||||||
|
'phone_number' => $request->phone_number,
|
||||||
|
'province_id' => $province->id,
|
||||||
|
'province_name' => $province->name,
|
||||||
|
'city_id' => $city->id,
|
||||||
|
'city_name' => $city->name,
|
||||||
|
'birth_date' => $request->birth_date,
|
||||||
|
'email' => $request->email,
|
||||||
|
'kyc_status' => 1,
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
return $this->successResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function changePassword(ChangePasswordRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
|
||||||
|
if (! Hash::check($request->current_password, $user->password)) {
|
||||||
|
return $this->errorResponse(__('messages.incorrect_current_password'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$user->update([
|
||||||
|
'password' => Hash::make($request->new_password),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $this->successResponse();
|
||||||
|
}
|
||||||
|
}
|
||||||
17
backend/app/User/Controllers/ProvinceController.php
Executable file
17
backend/app/User/Controllers/ProvinceController.php
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Province;
|
||||||
|
use App\Traits\ApiResponse;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
|
||||||
|
class ProvinceController extends Controller
|
||||||
|
{
|
||||||
|
use ApiResponse;
|
||||||
|
public function list(): JsonResponse
|
||||||
|
{
|
||||||
|
return $this->successResponse(Province::all(['id', 'name']));
|
||||||
|
}
|
||||||
|
}
|
||||||
23
backend/app/User/Events/LoginEmailEvent.php
Executable file
23
backend/app/User/Events/LoginEmailEvent.php
Executable file
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Events;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Broadcasting\Channel;
|
||||||
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
|
use Illuminate\Broadcasting\PrivateChannel;
|
||||||
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
class LoginEmailEvent
|
||||||
|
{
|
||||||
|
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new event instance.
|
||||||
|
*/
|
||||||
|
public function __construct(public User $user)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
31
backend/app/User/Listeners/SendEmailListener.php
Executable file
31
backend/app/User/Listeners/SendEmailListener.php
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Listeners;
|
||||||
|
|
||||||
|
use App\Mail\LoginNotificationMail;
|
||||||
|
use App\User\Events\LoginEmailEvent;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
|
||||||
|
class SendEmailListener implements ShouldQueue{
|
||||||
|
public string $queue = 'emails';
|
||||||
|
/**
|
||||||
|
* Create the event listener.
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the event.
|
||||||
|
*/
|
||||||
|
public function handle(LoginEmailEvent $event): void
|
||||||
|
{
|
||||||
|
$user = $event->user;
|
||||||
|
|
||||||
|
Mail::to($user->email)->send(
|
||||||
|
new LoginNotificationMail($user)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
30
backend/app/User/Requests/Auth/LoginRequest.php
Executable file
30
backend/app/User/Requests/Auth/LoginRequest.php
Executable file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Requests\Auth;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class LoginRequest 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 [
|
||||||
|
'login' => 'required|string',
|
||||||
|
'password' => 'required|string',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
31
backend/app/User/Requests/Auth/RegisterRequest.php
Executable file
31
backend/app/User/Requests/Auth/RegisterRequest.php
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Requests\Auth;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class RegisterRequest 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 [
|
||||||
|
'username' => 'required|unique:users,username',
|
||||||
|
'email' => 'required|email|unique:users,email',
|
||||||
|
'password' => 'required|string|regex:/^(?=.*[a-zA-Z])(?=.*\d).+$/|min:6|confirmed',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
31
backend/app/User/Requests/Documentation/EditRequest.php
Executable file
31
backend/app/User/Requests/Documentation/EditRequest.php
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Requests\Documentation;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class EditRequest 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 [
|
||||||
|
'documents' => 'required|array',
|
||||||
|
'documents.*.file' => 'required|file|mimes:pdf,jpg,jpeg,png|max:2048',
|
||||||
|
'documents.*.title' => 'required|string',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
31
backend/app/User/Requests/Documentation/UploadRequest.php
Executable file
31
backend/app/User/Requests/Documentation/UploadRequest.php
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Requests\Documentation;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class UploadRequest 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 [
|
||||||
|
'documents' => 'required|array',
|
||||||
|
'documents.*.file' => 'required|file|mimes:pdf,jpg,jpeg,png|max:2048',
|
||||||
|
'documents.*.title' => 'required|string',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
37
backend/app/User/Requests/Gateway/StoreRequest.php
Normal file
37
backend/app/User/Requests/Gateway/StoreRequest.php
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Requests\Gateway;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
class StoreRequest extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Determine if the user is authorized to make this request.
|
||||||
|
*/
|
||||||
|
public function authorize(): bool
|
||||||
|
{
|
||||||
|
return Auth::guard('web')->user()->kyc_status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array<string, ValidationRule|array|string>
|
||||||
|
*/
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => 'required|string|max:255',
|
||||||
|
'domain' => 'required|string|max:255',
|
||||||
|
'tax_id' => 'required|string',
|
||||||
|
'bank_name' => 'required|string|max:255',
|
||||||
|
'account_holder' => 'required|string',
|
||||||
|
'iban' => 'required|string|max:255',
|
||||||
|
'logo' => 'image|mimes:jpeg,png,jpg,gif,svg|max:2048',
|
||||||
|
'business_type_id' => 'required|string|exists:business_types,id',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
33
backend/app/User/Requests/Gateway/UpdateRequest.php
Normal file
33
backend/app/User/Requests/Gateway/UpdateRequest.php
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Requests\Gateway;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
class UpdateRequest extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Determine if the user is authorized to make this request.
|
||||||
|
*/
|
||||||
|
public function authorize(): bool
|
||||||
|
{
|
||||||
|
return Auth::guard('web')->user()->kyc_status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array<string, ValidationRule|array|string>
|
||||||
|
*/
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => 'required|string|max:255',
|
||||||
|
'domain' => 'required|string|max:255',
|
||||||
|
'business_type_id' => 'required|string|exists:business_types,id',
|
||||||
|
'logo' => 'image|mimes:jpeg,png,jpg,gif,svg|max:2048',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
30
backend/app/User/Requests/Profile/ChangePasswordRequest.php
Executable file
30
backend/app/User/Requests/Profile/ChangePasswordRequest.php
Executable file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Requests\Profile;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class ChangePasswordRequest 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 [
|
||||||
|
'current_password' => 'required|string|regex:/^(?=.*[a-zA-Z])(?=.*\d).+$/|min:6',
|
||||||
|
'new_password' => 'required|string|regex:/^(?=.*[a-zA-Z])(?=.*\d).+$/|min:6',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
44
backend/app/User/Requests/Profile/EditRequest.php
Executable file
44
backend/app/User/Requests/Profile/EditRequest.php
Executable file
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Requests\Profile;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
use Illuminate\Validation\Validator;
|
||||||
|
|
||||||
|
class EditRequest 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
|
||||||
|
{
|
||||||
|
$user = Auth::guard('web')->user();
|
||||||
|
|
||||||
|
return [
|
||||||
|
'first_name' => 'required|string|max:255',
|
||||||
|
'last_name' => 'required|string|max:255',
|
||||||
|
'national_id' => [Rule::prohibitedIf($user->kyc_status == 1), 'string',],
|
||||||
|
'email' => 'required|email|max:255',
|
||||||
|
'address' => 'required|string',
|
||||||
|
'postal_code' => 'required|string',
|
||||||
|
'phone_number' => 'required|string',
|
||||||
|
'province_id' => 'required|exists:provinces,id',
|
||||||
|
'city_id' => 'required|exists:cities,id',
|
||||||
|
'birth_date' => 'required|date',
|
||||||
|
'id_card' => [Rule::prohibitedIf($user->kyc_status == 1), 'image', 'mimes:jpeg,png,jpg,gif,svg', 'max:2048']
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user