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

@@ -3,7 +3,9 @@
namespace App\Http\Controllers;
use App\Models\Incoming;
use App\Models\Option;
use Illuminate\Contracts\View\View;
use Illuminate\Support\Facades\Date;
class IncomingController extends Controller
{
@@ -12,7 +14,19 @@ class IncomingController extends Controller
*/
public function index(): View
{
return view('incoming.index');
if (Option::where('name', '=', 'incoming_from')->count() > 0) {
$first = Option::where('name', '=', 'incoming_from')->first()->value;
} else {
$first = Date::now()->firstOfMonth()->format('Y-m-d');
}
if (Option::where('name', '=', 'incoming_end')->count() > 0) {
$last = Option::where('name', '=', 'incoming_end')->first()->value;
} else {
$last = Date::now()->format('Y-m-d');
}
return view('incoming.index', ['first' => $first, 'last' => $last]);
}
/**