Store time ranges for index sites.
This commit is contained in:
@@ -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]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user