Store time ranges for index sites.

This commit is contained in:
2025-02-06 11:53:40 +01:00
parent 4c43bf2193
commit 3884a54539
9 changed files with 61 additions and 9 deletions

View File

@@ -2,8 +2,10 @@
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
{
@@ -12,7 +14,18 @@ class PaymentController extends Controller
*/
public function index(): View
{
return view('payment.index');
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]);
}
/**