70 lines
1.9 KiB
PHP
Raw Normal View History

2017-09-14 22:21:00 +03:00
<?php
namespace App\Http\Controllers\Portal;
2017-09-14 22:21:00 +03:00
2019-11-16 10:21:14 +03:00
use App\Abstracts\Http\Controller;
use App\Models\Banking\Transaction;
2021-01-12 22:21:59 +03:00
use App\Models\Setting\Currency;
2020-09-06 17:06:10 +03:00
use App\Http\Requests\Portal\PaymentShow as Request;
2017-09-14 22:21:00 +03:00
use App\Utilities\Modules;
2021-06-25 10:05:41 +03:00
use Illuminate\Support\Facades\URL;
2017-09-14 22:21:00 +03:00
class Payments extends Controller
{
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
2021-01-12 22:21:59 +03:00
$search = request()->get('search');
$payments = Transaction::income()->where('contact_id', '=', user()->contact->id)->usingSearchString($search)->sortable('paid_at')->paginate();
2017-09-14 22:21:00 +03:00
$payment_methods = Modules::getPaymentMethods('all');
2017-09-14 22:21:00 +03:00
2020-11-06 00:43:46 +03:00
return $this->response('portal.payments.index', compact('payments', 'payment_methods'));
2017-09-14 22:21:00 +03:00
}
/**
* Show the form for viewing the specified resource.
*
2019-11-16 10:21:14 +03:00
* @param Transaction $payment
2017-09-14 22:21:00 +03:00
*
* @return Response
*/
2020-09-06 17:06:10 +03:00
public function show(Transaction $payment, Request $request)
2017-09-14 22:21:00 +03:00
{
2019-11-16 10:21:14 +03:00
$payment_methods = Modules::getPaymentMethods('all');
2017-09-14 22:21:00 +03:00
2019-11-16 10:21:14 +03:00
return view('portal.payments.show', compact('payment', 'payment_methods'));
2017-09-14 22:21:00 +03:00
}
2021-01-12 22:21:59 +03:00
/**
* Display a listing of the resource.
*
* @return Response
*/
public function currencies()
{
$currencies = Currency::collect();
return $this->response('portal.currencies.index', compact('currencies'));
}
2021-06-25 10:05:41 +03:00
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'));
}
2017-09-14 22:21:00 +03:00
}