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