Store time ranges for index sites.
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
|
||||
use App\Http\Option;
|
||||
use App\Models\Invoice;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Facades\Date;
|
||||
|
||||
class InvoiceController extends Controller
|
||||
{
|
||||
@@ -13,7 +14,19 @@ class InvoiceController extends Controller
|
||||
*/
|
||||
public function index(): View
|
||||
{
|
||||
return view('invoice.index');
|
||||
if (\App\Models\Option::where('name', '=', 'invoice_from')->count() > 0) {
|
||||
$first = \App\Models\Option::where('name', '=', 'invoice_from')->first()->value;
|
||||
} else {
|
||||
$first = Date::now()->firstOfMonth()->format('Y-m-d');
|
||||
}
|
||||
|
||||
if (\App\Models\Option::where('name', '=', 'invoice_end')->count() > 0) {
|
||||
$last = \App\Models\Option::where('name', '=', 'invoice_end')->first()->value;
|
||||
} else {
|
||||
$last = Date::now()->format('Y-m-d');
|
||||
}
|
||||
|
||||
return view('invoice.index', ['first' => $first, 'last' => $last]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user