Skip to content

Commit

Permalink
function to get kasbon data per month and year
Browse files Browse the repository at this point in the history
  • Loading branch information
GesangPJ committed Jun 12, 2024
1 parent 972333e commit 190a208
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions app/Models/Kasbonview.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Models;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
Expand Down Expand Up @@ -63,5 +64,22 @@ public static function jumlahKasbonKaryawan(){
];
}

public function index()
{
return view('admin.laporan');
}

public function getKasbonData(Request $request)
{
$month = $request->input('month');
$year = $request->input('year');

$kasbonData = Kasbonview::whereMonth('updated_at', $month)
->whereYear('updated_at', $year)
->get();

return response()->json($kasbonData); // Ensure this returns JSON
}


}

0 comments on commit 190a208

Please sign in to comment.