2021-06-25 10:05:41 +03:00

70 lines
1.9 KiB
PHP

<?php
namespace App\Http\Controllers\Portal;
use App\Abstracts\Http\Controller;
use App\Models\Banking\Transaction;
use App\Models\Setting\Currency;
use App\Http\Requests\Portal\PaymentShow as Request;
use App\Utilities\Modules;
use Illuminate\Support\Facades\URL;
class Payments extends Controller
{
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$search = request()->get('search');
$payments = Transaction::income()->where('contact_id', '=', user()->contact->id)->usingSearchString($search)->sortable('paid_at')->paginate();
$payment_methods = Modules::getPaymentMethods('all');
return $this->response('portal.payments.index', compact('payments', 'payment_methods'));
}
/**
* Show the form for viewing the specified resource.
*
* @param Transaction $payment
*
* @return Response
*/
public function show(Transaction $payment, Request $request)
{
$payment_methods = Modules::getPaymentMethods('all');
return view('portal.payments.show', compact('payment', 'payment_methods'));
}
/**
* Display a listing of the resource.
*
* @return Response
*/
public function currencies()
{
$currencies = Currency::collect();
return $this->response('portal.currencies.index', compact('currencies'));
}
public function signed(Transaction $payment)
{
if (empty($payment)) {
return redirect()->route('login');
}
$payment_methods = Modules::getPaymentMethods();
$print_action = URL::signedRoute('signed.payments.print', [$payment->id]);
$pdf_action = URL::signedRoute('signed.payments.pdf', [$payment->id]);
return view('portal.payments.signed', compact('payment', 'payment_methods', 'print_action', 'pdf_action'));
}
}