feat(dashboard/rekap-so): penambahan dashboard, rekap so
This commit is contained in:
36
app/Http/Controllers/DashboardController.php
Normal file
36
app/Http/Controllers/DashboardController.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\Lpj\Services\DashboardService;
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
public $dashboardService;
|
||||
public function __construct(DashboardService $dashboardService)
|
||||
{
|
||||
$this->dashboardService = $dashboardService;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
// nilai default
|
||||
$start_date = $request->input('start_date', now()->startOfYear()->format('Y-m-d'));
|
||||
$end_date = $request->input('end_date', now()->format('Y-m-d'));
|
||||
|
||||
$validate = $request->validate([
|
||||
'start_date' => 'nullable|date_format:Y-m-d',
|
||||
'end_date' => 'nullable|date_format:Y-m-d',
|
||||
]);
|
||||
|
||||
$dashboard = $this->dashboardService->getDashboardData($start_date, $end_date);
|
||||
|
||||
// dd($dashboard);
|
||||
return view('lpj::dashboard.index', compact('dashboard'));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user