feat: add withdraw request functionality and UI components

This commit is contained in:
2026-08-27 02:39:57 +03:30
parent aeef95339d
commit 4ce663c669
115 changed files with 4064 additions and 315 deletions
@@ -0,0 +1,45 @@
<?php
namespace App\Http\Controllers\Client;
use App\Http\Controllers\Controller;
use App\Http\Resources\Client\InvoiceResource;
use App\Models\Invoice;
use App\Services\Wallet\WalletService;
use Illuminate\Support\Facades\Auth;
use Inertia\Inertia;
class InvoiceController extends Controller
{
protected WalletService $walletService;
public function __construct(WalletService $walletService)
{
$this->walletService = $walletService;
}
public function index()
{
$invoices = Auth::user()->invoices()
->with('document')
->latest()
->paginate(10)
->withQueryString()
->onEachSide(1);
return Inertia::client('Dashboard/Invoices/Index', [
'invoices' => InvoiceResource::collection($invoices),
]);
}
public function payWithWallet(Invoice $invoice)
{
abort_unless($invoice->user_id === Auth::id(), 403);
$invoice = $this->walletService->payInvoice(Auth::user(), $invoice);
return response()->json([
'invoice' => new InvoiceResource($invoice),
]);
}
}