48 lines
1.4 KiB
PHP
Raw Normal View History

2017-09-14 22:21:00 +03:00
<?php
2019-11-16 10:21:14 +03:00
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;
2017-09-14 22:21:00 +03:00
use App\Models\Banking\Account;
2019-11-16 10:21:14 +03:00
use App\Models\Banking\Transaction;
use App\Models\Setting\Category;
2017-09-14 22:21:00 +03:00
use App\Utilities\Modules;
class Payments extends Controller
{
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
2019-11-16 10:21:14 +03:00
$payments = Transaction::type('income')->with(['account', 'category'])->where('contact_id', '=', user()->contact->id)->paginate();
2017-09-14 22:21:00 +03:00
$payment_methods = Modules::getPaymentMethods('all');
2017-09-14 22:21:00 +03:00
2019-11-16 10:21:14 +03:00
$categories = collect(Category::type('income')->enabled()->pluck('name', 'id'))
2017-09-27 21:58:43 +03:00
->prepend(trans('general.all_type', ['type' => trans_choice('general.categories', 2)]), '');
2017-09-14 22:21:00 +03:00
$accounts = collect(Account::enabled()->pluck('name', 'id'))
2017-09-27 21:58:43 +03:00
->prepend(trans('general.all_type', ['type' => trans_choice('general.accounts', 2)]), '');
2017-09-14 22:21:00 +03:00
2019-11-16 10:21:14 +03:00
return view('portal.payments.index', compact('payments', 'payment_methods', 'categories', 'accounts'));
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
*/
2019-11-16 10:21:14 +03:00
public function show(Transaction $payment)
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
}
}