48 lines
1.2 KiB
PHP
48 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\Option;
|
|
use App\Models\Payment;
|
|
use Illuminate\Contracts\View\View;
|
|
use Illuminate\Support\Facades\Date;
|
|
|
|
class PaymentController extends Controller
|
|
{
|
|
/**
|
|
* Display a listing of the resource.
|
|
*/
|
|
public function index(): View
|
|
{
|
|
if (Option::where('name', '=', 'payment_from')->count() > 0) {
|
|
$first = Option::where('name', '=', 'payment_from')->first()->value;
|
|
} else {
|
|
$first = Date::now()->firstOfMonth()->format('Y-m-d');
|
|
}
|
|
|
|
if (Option::where('name', '=', 'payment_end')->count() > 0) {
|
|
$last = Option::where('name', '=', 'payment_end')->first()->value;
|
|
} else {
|
|
$last = Date::now()->format('Y-m-d');
|
|
}
|
|
return view('payment.index', ['first' => $first, 'last' => $last]);
|
|
}
|
|
|
|
/**
|
|
* Show the form for creating a new resource.
|
|
*/
|
|
public function create(): View
|
|
{
|
|
return view('payment.create');
|
|
}
|
|
|
|
/**
|
|
* Show the form for editing the specified resource.
|
|
*/
|
|
public function edit(Payment $payment): View
|
|
{
|
|
return view('payment.edit', ['payment' => $payment->load('invoice')]);
|
|
}
|
|
|
|
}
|