Compare commits
18 Commits
feature/Cr
...
feature/Cr
| Author | SHA1 | Date | |
|---|---|---|---|
| 85d3baa2c4 | |||
| 81401060b0 | |||
| f3a9b5e788 | |||
| d04277ece5 | |||
| e53a89016f | |||
| 53f2303253 | |||
| c6dc5256e6 | |||
| 19abb28acf | |||
| c994a3cbd0 | |||
| 431acd9279 | |||
| 9fcd8045db | |||
| 7c82556d93 | |||
| 581e7af1fd | |||
| b433d2ff52 | |||
| 6f06218cb2 | |||
| 1a2077a164 | |||
| 363c7005d0 | |||
| f29510d76e |
@@ -2,26 +2,34 @@
|
|||||||
|
|
||||||
namespace App\Admin\Controllers;
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Admin\Requests\Auth\LoginRequest;
|
||||||
|
use App\Admin\Requests\Auth\RegisterRequest;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Expert;
|
||||||
use App\Traits\ApiResponse;
|
use App\Traits\ApiResponse;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
|
||||||
class AuthController extends Controller
|
class AuthController extends Controller
|
||||||
{
|
{
|
||||||
use ApiResponse;
|
use ApiResponse;
|
||||||
|
|
||||||
public function register(Request $request): JsonResponse
|
public function register(RegisterRequest $request): JsonResponse
|
||||||
{
|
{
|
||||||
// Expert::query()->create();
|
Expert::query()->create([
|
||||||
|
'username' => $request->username,
|
||||||
|
'email' => $request->email,
|
||||||
|
'password' => Hash::make($request->password),
|
||||||
|
]);
|
||||||
|
|
||||||
$request->session()->regenerate();
|
$request->session()->regenerate();
|
||||||
|
|
||||||
return $this->successResponse();
|
return $this->successResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function login(Request $request): JsonResponse
|
public function login(LoginRequest $request): JsonResponse
|
||||||
{
|
{
|
||||||
$credentials = ['password' => $request->password];
|
$credentials = ['password' => $request->password];
|
||||||
|
|
||||||
@@ -35,13 +43,7 @@ class AuthController extends Controller
|
|||||||
{
|
{
|
||||||
$request->session()->regenerate();
|
$request->session()->regenerate();
|
||||||
|
|
||||||
$user = Auth::user();
|
return $this->successResponse();
|
||||||
|
|
||||||
return $this->successResponse([
|
|
||||||
'id' => $user->id,
|
|
||||||
'username' => $user->username,
|
|
||||||
'email' => $user->email,
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->errorResponse(__('messages.incorrect_or_username_password'));
|
return $this->errorResponse(__('messages.incorrect_or_username_password'));
|
||||||
@@ -49,7 +51,7 @@ class AuthController extends Controller
|
|||||||
|
|
||||||
public function logout(Request $request): JsonResponse
|
public function logout(Request $request): JsonResponse
|
||||||
{
|
{
|
||||||
Auth::logout();
|
Auth::guard('expert')->logout();
|
||||||
|
|
||||||
$request->session()->invalidate();
|
$request->session()->invalidate();
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Admin\Controllers;
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Admin\Requests\Documentation\RejectRequest;
|
||||||
use App\Facades\DataTable\DataTableFacade;
|
use App\Facades\DataTable\DataTableFacade;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
@@ -16,31 +17,37 @@ class DocumentationController extends Controller
|
|||||||
public function index(Request $request): array
|
public function index(Request $request): array
|
||||||
{
|
{
|
||||||
return DataTableFacade::run(
|
return DataTableFacade::run(
|
||||||
User::query()->with('documents'),
|
User::query(),
|
||||||
$request,
|
$request,
|
||||||
allowedFilters: ['*'],
|
allowedFilters: ['*'],
|
||||||
allowedSortings: ['*'],
|
allowedSortings: ['*'],
|
||||||
allowedSelects: [
|
allowedSelects: [
|
||||||
'users.id', 'users.first_name', 'users.last_name', 'users.national_id',
|
'id', 'first_name', 'last_name', 'national_id',
|
||||||
'users.phone_number', 'users.postal_code', 'users.city_id', 'users.province_id',
|
'phone_number', 'postal_code', 'city_id', 'province_id',
|
||||||
'users.province_name', 'users.city_name', 'users.address', 'documents.title', 'documents.url'
|
'province_name', 'city_name', 'address'
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function files(User $user): JsonResponse
|
||||||
|
{
|
||||||
|
return $this->successResponse($user->load('documents'));
|
||||||
|
}
|
||||||
|
|
||||||
public function confirm(User $user): JsonResponse
|
public function confirm(User $user): JsonResponse
|
||||||
{
|
{
|
||||||
$user->update([
|
$user->update([
|
||||||
|
'authority_level' => 1
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $this->successResponse();
|
return $this->successResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function reject(User $user): JsonResponse
|
public function reject(RejectRequest $request, User $user): JsonResponse
|
||||||
{
|
{
|
||||||
$user->update([
|
$user->update([
|
||||||
|
'kyc_status' => 0,
|
||||||
|
'kyc_reject_reason' => $request->kyc_reject_reason
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $this->successResponse();
|
return $this->successResponse();
|
||||||
|
|||||||
@@ -67,8 +67,7 @@ class ExpertManagementController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function show(Expert $expert): JsonResponse
|
public function show(Expert $expert): JsonResponse
|
||||||
{
|
{
|
||||||
return $this->successResponse(
|
return $this->successResponse($expert->load(['roles','permissions'])
|
||||||
new ExpertManagementResource($expert)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,14 @@
|
|||||||
|
|
||||||
namespace App\Admin\Controllers;
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Admin\Requests\Profile\ChangePasswordRequest;
|
||||||
|
use App\Admin\Requests\Profile\EditRequest;
|
||||||
use App\Admin\Resources\ExpertResource;
|
use App\Admin\Resources\ExpertResource;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Traits\ApiResponse;
|
use App\Traits\ApiResponse;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
|
||||||
class ProfileController extends Controller
|
class ProfileController extends Controller
|
||||||
{
|
{
|
||||||
@@ -14,6 +17,41 @@ class ProfileController extends Controller
|
|||||||
|
|
||||||
public function info(): JsonResponse
|
public function info(): JsonResponse
|
||||||
{
|
{
|
||||||
return $this->successResponse(new ExpertResource(Auth::user()));
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
30
backend/app/Admin/Requests/Auth/LoginRequest.php
Normal file
30
backend/app/Admin/Requests/Auth/LoginRequest.php
Normal 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
Normal file
31
backend/app/Admin/Requests/Auth/RegisterRequest.php
Normal 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
Normal file
29
backend/app/Admin/Requests/Documentation/RejectRequest.php
Normal 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',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -27,7 +27,7 @@ class UpdateRequest extends FormRequest
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name' => ['required', 'string', 'max:255', Rule::unique('permission', 'name')->ignore($this->permission->id)],
|
'name' => ['required', 'string', 'max:255', Rule::unique('permissions', 'name')->ignore($this->permission->id)],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
30
backend/app/Admin/Requests/Profile/ChangePasswordRequest.php
Normal file
30
backend/app/Admin/Requests/Profile/ChangePasswordRequest.php
Normal 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',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
36
backend/app/Admin/Requests/Profile/EditRequest.php
Normal file
36
backend/app/Admin/Requests/Profile/EditRequest.php
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Requests\Profile;
|
||||||
|
|
||||||
|
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 [
|
||||||
|
'username' => 'string|max:255',
|
||||||
|
'first_name' => 'string',
|
||||||
|
'last_name' => 'string',
|
||||||
|
'email' => 'string|email|max:255',
|
||||||
|
'national_id' => 'string',
|
||||||
|
'phone_number' => 'string',
|
||||||
|
'province_id' => 'string',
|
||||||
|
'city_id' => 'string',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,8 +24,8 @@ class StoreRequest extends FormRequest
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name' => 'required|string|unique:roles,name',
|
'name' => 'required|string|unique:roles,name',
|
||||||
'permissions' => 'required|array',
|
'permissions' => 'array',
|
||||||
'permissions.*.name' => 'required|string|exists:permissions,name',
|
'permissions.*' => 'integer|exists:permissions,id',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,9 +27,9 @@ class UpdateRequest extends FormRequest
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name' => ['required', 'string', 'max:255', Rule::unique('roles', 'name')->ignore($this->role->id)],
|
'name' => ['string', 'max:255', Rule::unique('roles', 'name')->ignore($this->role->id)],
|
||||||
'permissions' => 'required|array',
|
'permissions' => 'array',
|
||||||
'permissions.*.name' => 'required|string|exists:permissions,name',
|
'permissions.*' => 'integer|exists:permissions,id',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Admin\Resources;
|
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @method roles()
|
|
||||||
* @method getAllPermissions()
|
|
||||||
*/
|
|
||||||
class ExpertManagementResource 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,
|
|
||||||
'first_name' => $this->first_name,
|
|
||||||
'last_name' => $this->last_name,
|
|
||||||
'national_id' => $this->national_id,
|
|
||||||
'email' => $this->email,
|
|
||||||
'phone_number' => $this->phone_number,
|
|
||||||
'province_name' => $this->province_name,
|
|
||||||
'city_name' => $this->city_name,
|
|
||||||
'roles' => $this->roles()
|
|
||||||
->pluck('name')
|
|
||||||
->values(),
|
|
||||||
|
|
||||||
'permissions' => $this->getAllPermissions()
|
|
||||||
->pluck('name')
|
|
||||||
->values(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -5,6 +5,7 @@ namespace App\Models;
|
|||||||
use Database\Factories\ExpertFactory;
|
use Database\Factories\ExpertFactory;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Spatie\Permission\Traits\HasRoles;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method roles()
|
* @method roles()
|
||||||
@@ -14,6 +15,8 @@ class Expert extends Model
|
|||||||
{
|
{
|
||||||
/** @use HasFactory<ExpertFactory> */
|
/** @use HasFactory<ExpertFactory> */
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
use HasRoles;
|
||||||
|
|
||||||
protected $guarded = ['id'];
|
protected $guarded = ['id'];
|
||||||
|
protected string $guard_name = 'web';
|
||||||
}
|
}
|
||||||
|
|||||||
15
backend/app/Models/Gateway.php
Normal file
15
backend/app/Models/Gateway.php
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Database\Factories\GatewayFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Gateway extends Model
|
||||||
|
{
|
||||||
|
/** @use HasFactory<GatewayFactory> */
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $guarded = ['id'];
|
||||||
|
}
|
||||||
15
backend/app/Models/GatewayCategory.php
Normal file
15
backend/app/Models/GatewayCategory.php
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Database\Factories\GatewayCategoryFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class GatewayCategory extends Model
|
||||||
|
{
|
||||||
|
/** @use HasFactory<GatewayCategoryFactory> */
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $guarded = ['id'];
|
||||||
|
}
|
||||||
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'];
|
||||||
|
}
|
||||||
@@ -18,12 +18,14 @@ class AuthController extends Controller
|
|||||||
|
|
||||||
public function register(RegisterRequest $request): JsonResponse
|
public function register(RegisterRequest $request): JsonResponse
|
||||||
{
|
{
|
||||||
User::query()->create([
|
$user = User::query()->create([
|
||||||
'username' => $request->username,
|
'username' => $request->username,
|
||||||
'email' => $request->email,
|
'email' => $request->email,
|
||||||
'password' => Hash::make($request->password),
|
'password' => Hash::make($request->password),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
Auth::guard('web')->login($user);
|
||||||
|
|
||||||
$request->session()->regenerate();
|
$request->session()->regenerate();
|
||||||
|
|
||||||
return $this->successResponse();
|
return $this->successResponse();
|
||||||
@@ -43,13 +45,7 @@ class AuthController extends Controller
|
|||||||
{
|
{
|
||||||
$request->session()->regenerate();
|
$request->session()->regenerate();
|
||||||
|
|
||||||
$user = Auth::user();
|
return $this->successResponse();
|
||||||
|
|
||||||
return $this->successResponse([
|
|
||||||
'id' => $user->id,
|
|
||||||
'username' => $user->username,
|
|
||||||
'email' => $user->email,
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->errorResponse(__('messages.incorrect_or_username_password'));
|
return $this->errorResponse(__('messages.incorrect_or_username_password'));
|
||||||
@@ -57,7 +53,7 @@ class AuthController extends Controller
|
|||||||
|
|
||||||
public function logout(Request $request): JsonResponse
|
public function logout(Request $request): JsonResponse
|
||||||
{
|
{
|
||||||
Auth::logout();
|
Auth::guard('web')->logout();
|
||||||
|
|
||||||
$request->session()->invalidate();
|
$request->session()->invalidate();
|
||||||
|
|
||||||
|
|||||||
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
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',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
24
backend/database/factories/GatewayCategoryFactory.php
Normal file
24
backend/database/factories/GatewayCategoryFactory.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Factories;
|
||||||
|
|
||||||
|
use App\Models\GatewayCategory;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @extends Factory<GatewayCategory>
|
||||||
|
*/
|
||||||
|
class GatewayCategoryFactory extends Factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function definition(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
24
backend/database/factories/GatewayFactory.php
Normal file
24
backend/database/factories/GatewayFactory.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Factories;
|
||||||
|
|
||||||
|
use App\Models\Gateway;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @extends Factory<Gateway>
|
||||||
|
*/
|
||||||
|
class GatewayFactory extends Factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function definition(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
24
backend/database/factories/PaymentFactory.php
Normal file
24
backend/database/factories/PaymentFactory.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Factories;
|
||||||
|
|
||||||
|
use App\Models\Payment;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @extends Factory<Payment>
|
||||||
|
*/
|
||||||
|
class PaymentFactory extends Factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function definition(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
24
backend/database/factories/PaymentStatusFactory.php
Normal file
24
backend/database/factories/PaymentStatusFactory.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Factories;
|
||||||
|
|
||||||
|
use App\Models\PaymentStatus;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @extends Factory<PaymentStatus>
|
||||||
|
*/
|
||||||
|
class PaymentStatusFactory extends Factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function definition(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -29,6 +29,7 @@ return new class extends Migration
|
|||||||
$table->string('province_name')->nullable();
|
$table->string('province_name')->nullable();
|
||||||
$table->foreignId('city_id')->nullable()->constrained('cities');
|
$table->foreignId('city_id')->nullable()->constrained('cities');
|
||||||
$table->string('city_name')->nullable();
|
$table->string('city_name')->nullable();
|
||||||
|
$table->tinyInteger('authority_level')->default(0);
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ return new class extends Migration
|
|||||||
$table->string('province_name')->nullable();
|
$table->string('province_name')->nullable();
|
||||||
$table->foreignId('city_id')->nullable()->constrained('cities');
|
$table->foreignId('city_id')->nullable()->constrained('cities');
|
||||||
$table->string('city_name')->nullable();
|
$table->string('city_name')->nullable();
|
||||||
$table->tinyInteger('level')->default(1);
|
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('users', function (Blueprint $table) {
|
||||||
|
$table->string('kyc_reject_reason')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('users', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('kyc_reject_reason');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('payment_statuses', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('name');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('payment_statuses');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('gateway_categories', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('name');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('gateway_categories');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('gateways', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('user_id')->constrained('users');
|
||||||
|
$table->string('username');
|
||||||
|
$table->string('name');
|
||||||
|
$table->string('domain');
|
||||||
|
$table->string('tax_id');
|
||||||
|
$table->string('bank_name');
|
||||||
|
$table->string('account_holder');
|
||||||
|
$table->string('logo')->nullable();
|
||||||
|
$table->string('iban');
|
||||||
|
$table->foreignId('category_id')->constrained('gateway_categories');
|
||||||
|
$table->string('category_name');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('gateways');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('payments', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('user_id')->constrained('users');
|
||||||
|
$table->string('username');
|
||||||
|
$table->uuid('track_id');
|
||||||
|
$table->string('amount');
|
||||||
|
$table->string('currency');
|
||||||
|
$table->string('callback_url');
|
||||||
|
$table->dateTime('expires_at');
|
||||||
|
$table->foreignId('status_id')->constrained('payment_statuses');
|
||||||
|
$table->string('status_name');
|
||||||
|
$table->ipAddress('ip');
|
||||||
|
$table->foreignId('gateway_id')->constrained('gateways');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('payments');
|
||||||
|
}
|
||||||
|
};
|
||||||
17
backend/database/seeders/GatewayCategorySeeder.php
Normal file
17
backend/database/seeders/GatewayCategorySeeder.php
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class GatewayCategorySeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*/
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
17
backend/database/seeders/GatewaySeeder.php
Normal file
17
backend/database/seeders/GatewaySeeder.php
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class GatewaySeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*/
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
17
backend/database/seeders/PaymentSeeder.php
Normal file
17
backend/database/seeders/PaymentSeeder.php
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class PaymentSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*/
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
17
backend/database/seeders/PaymentStatusSeeder.php
Normal file
17
backend/database/seeders/PaymentStatusSeeder.php
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class PaymentStatusSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*/
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,12 +1,85 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use App\Admin\Controllers\AuthController;
|
||||||
use App\Admin\Controllers\DocumentationController;
|
use App\Admin\Controllers\DocumentationController;
|
||||||
|
use App\Admin\Controllers\ExpertManagementController;
|
||||||
|
use App\Admin\Controllers\PermissionManagementController;
|
||||||
|
use App\Admin\Controllers\RoleManagementController;
|
||||||
|
use App\Admin\Controllers\UserManagementController;
|
||||||
|
use App\Admin\Controllers\ProfileController;
|
||||||
|
|
||||||
|
Route::prefix('auth')
|
||||||
|
->name('auth.')
|
||||||
|
->controller(AuthController::class)
|
||||||
|
->group(function () {
|
||||||
|
Route::post('register', 'register')->name('register');
|
||||||
|
Route::post('login', 'login')->name('login');
|
||||||
|
Route::post('logout', 'logout')->name('logout');
|
||||||
|
});
|
||||||
|
|
||||||
Route::prefix('documents')
|
Route::prefix('documents')
|
||||||
->name('documents.')
|
->name('documents.')
|
||||||
|
->middleware('auth:expert')
|
||||||
->controller(DocumentationController::class)
|
->controller(DocumentationController::class)
|
||||||
->group(function () {
|
->group(function () {
|
||||||
Route::post('/', 'index')->name('index');
|
Route::get('/', 'index')->name('index');
|
||||||
Route::post('confirm', 'confirm')->name('confirm');
|
Route::post('confirm/{user}', 'confirm')->name('confirm');
|
||||||
Route::post('reject', 'reject')->name('reject');
|
Route::post('reject/{user}', 'reject')->name('reject');
|
||||||
|
Route::get('files/{user}', 'files')->name('files');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::prefix('user_management')
|
||||||
|
->middleware(['auth:expert', 'permission:user-management'])
|
||||||
|
->name('user_management.')
|
||||||
|
->controller(UserManagementController::class)
|
||||||
|
->group(function () {
|
||||||
|
Route::get('/', 'index')->name('index');
|
||||||
|
Route::post('/', 'store')->name('store');
|
||||||
|
Route::get('/{user}', 'show')->name('show');
|
||||||
|
Route::post('/{user}', 'update')->name('update');
|
||||||
|
Route::delete('/{user}', 'destroy')->name('destroy');
|
||||||
|
});
|
||||||
|
Route::prefix('roles')
|
||||||
|
->name('roles.')
|
||||||
|
->middleware(['auth:expert', 'permission:role-management'])
|
||||||
|
->controller(RoleManagementController::class)
|
||||||
|
->group(function () {
|
||||||
|
Route::get('/', 'index')->name('index');
|
||||||
|
Route::post('/', 'store')->name('store');
|
||||||
|
Route::get('/{role}', 'show')->name('show');
|
||||||
|
Route::post('/{role}', 'update')->name('update');
|
||||||
|
Route::delete('/{role}', 'destroy')->name('destroy');
|
||||||
|
});
|
||||||
|
Route::prefix('permissions')
|
||||||
|
->name('permissions.')
|
||||||
|
->middleware(['auth:expert', 'permission:permission-management'])
|
||||||
|
->controller(PermissionManagementController::class)
|
||||||
|
->group(function () {
|
||||||
|
Route::get('/', 'index')->name('index');
|
||||||
|
Route::post('/', 'store')->name('store');
|
||||||
|
Route::get('/{permission}', 'show')->name('show');
|
||||||
|
Route::post('/{permission}', 'update')->name('update');
|
||||||
|
Route::delete('/{permission}', 'destroy')->name('destroy');
|
||||||
|
});
|
||||||
|
Route::prefix('expert')
|
||||||
|
->name('expert.')
|
||||||
|
->middleware(['auth:expert', 'permission:expert-management'])
|
||||||
|
->controller(ExpertManagementController::class)
|
||||||
|
->group(function () {
|
||||||
|
Route::get('/', 'index')->name('index');
|
||||||
|
Route::post('/', 'store')->name('store');
|
||||||
|
Route::get('/{expert}', 'show')->name('show');
|
||||||
|
Route::post('/{expert}', 'update')->name('update');
|
||||||
|
Route::delete('/{expert}', 'destroy')->name('destroy');
|
||||||
|
});
|
||||||
|
|
||||||
|
Route::prefix('profile')
|
||||||
|
->name('profile.')
|
||||||
|
->middleware('auth')
|
||||||
|
->controller(ProfileController::class)
|
||||||
|
->group(function () {
|
||||||
|
Route::get('info', 'info')->name('info');
|
||||||
|
Route::post('edit', 'edit')->name('edit');
|
||||||
|
Route::post('change_password', 'changePassword')->name('changePassword');
|
||||||
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user