fix onfilixt
This commit is contained in:
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'];
|
||||
}
|
||||
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 [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
use App\Admin\Controllers\AuthController;
|
||||
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')
|
||||
@@ -19,11 +23,56 @@ Route::prefix('documents')
|
||||
->controller(DocumentationController::class)
|
||||
->group(function () {
|
||||
Route::get('/', 'index')->name('index');
|
||||
Route::post('confirm', 'confirm')->name('confirm');
|
||||
Route::post('reject', 'reject')->name('reject');
|
||||
Route::post('confirm/{user}', 'confirm')->name('confirm');
|
||||
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')
|
||||
|
||||
Reference in New Issue
Block a user