{{-- resources/views/admin/payments/gateways.blade.php --}} @extends('admin.layouts.app') @section('title', 'بوابات الدفع') @php use Illuminate\Support\Facades\Route; /** @var array $gateways */ $gateways = is_array($gateways ?? null) ? $gateways : []; $known = ['title','description','base_url','secret','publishable','profile_id','server_key','merchant_id','region','mode','success_status','fail_status','currency']; $saveOk = Route::has('admin.gateways.save'); @endphp @section('content')

بوابات الدفع

تحديث
@if(!$saveOk)
مسار الحفظ غير معرّف. أضِف داخل مجموعة admin في routes/web.php:
Route::get('/gateways', [\App\Http\Controllers\Admin\PaymentGatewaySettingsController::class, 'index'])->name('gateways.index');
Route::post('/gateways', [\App\Http\Controllers\Admin\PaymentGatewaySettingsController::class, 'save'])->name('gateways.save');
@endif @if(!empty($storage))
سيتم الحفظ في الجدول: {{ $storage['table'] ?? '' }} — المفتاح: {{ $storage['key_col'] ?? '' }} — القيمة (JSON): {{ $storage['val_col'] ?? '' }}
المفتاح المحفوظ: payments.gateways
@endif
{{-- ================= فورم ================= --}}
@csrf
@forelse($gateways as $name => $cfg) @php $id = strtolower((string)$name); $cfg = is_array($cfg) ? $cfg : []; $enabled = !empty($cfg['enabled']); $extra = collect($cfg)->filter(fn($v,$k)=>!in_array($k,$known) && $k!=='enabled')->all(); @endphp
{{ strtoupper($id) }} {{ $cfg['title'] ?? '' }}
@php $mode = $cfg['mode'] ?? 'live'; @endphp
{{-- مفاتيح إضافية --}} @php $extraIndex = 0; @endphp
مفاتيح إضافية (اختياري)
@foreach($extra as $k => $v)
@endforeach
@empty
لا توجد بوابات بعد. اضغط زر “إضافة بوابة جديدة”.
@endforelse
مسار الرجوع: {{ url('/payments/callback/{gateway}') }} — ويبهوك: {{ url('/payments/webhook/{gateway}') }}
{{-- ================= JSON ================= --}}
@csrf
الصيغة المتوقعة: {"stripe":{"enabled":true,"secret":"...","base_url":"..."}, "paytabs":{...}}
@endsection @push('scripts') @endpush