phpvms/app/Http/Controllers/Admin/FinanceController.php

67 lines
1.6 KiB
PHP
Raw Normal View History

<?php
namespace App\Http\Controllers\Admin;
use App\Contracts\Controller;
use App\Models\Enums\JournalType;
use App\Models\Journal;
use App\Repositories\AirlineRepository;
use App\Services\FinanceService;
use App\Support\Dates;
use Illuminate\Http\Request;
class FinanceController extends Controller
{
private $airlineRepo;
private $financeSvc;
/**
2018-08-27 00:40:04 +08:00
* @param AirlineRepository $airlineRepo
* @param FinanceService $financeSvc
*/
public function __construct(
AirlineRepository $airlineRepo,
FinanceService $financeSvc
) {
$this->airlineRepo = $airlineRepo;
$this->financeSvc = $financeSvc;
}
/**
* Display the summation tables for a given month by airline
2018-08-27 00:40:04 +08:00
*
* @param Request $request
2018-08-27 00:40:04 +08:00
*
* @throws \UnexpectedValueException
* @throws \InvalidArgumentException
2018-08-27 00:40:04 +08:00
*
* @return mixed
*/
public function index(Request $request)
{
$month = $request->query('month', date('Y-m'));
$transaction_groups = $this->financeSvc->getAllAirlineTransactionsBetween($month);
$first_journal = Journal::select(['created_at'])
->where(['type' => JournalType::AIRLINE])
->orderBy('created_at', 'asc')
->limit(1)
->first();
return view('admin.finances.index', [
'current_month' => $month,
'months_list' => Dates::getMonthsList($first_journal->created_at),
'transaction_groups' => $transaction_groups,
]);
}
/**
* Show a month
2018-08-27 00:40:04 +08:00
*
* @param mixed $id
*/
public function show($id)
{
}
}