So, I had to find an interval between two dates, one is from system time, and one is from the database. First problem is, I used get()
so it returns an array from the database and I have absolutely no idea on how to work on it. Can anyone tell me what is the best way to deal with this? I just need to get the number of days between $tenggat
and $curdate
.
public function tower_kecamatan(Request $r){
$kode_kecamatan = $r->kode_kecamatan;
$region = DB::table('region')
->where('kode_kecamatan',$kode_kecamatan)->first();
$data = DB::table('tower')
->leftJoin("perusahaan","perusahaan.tower_id","=","tower.tower_id")
->select('tower.*','perusahaan.*')
->where('kode_kecamatan', $kode_kecamatan)->get();
$tenggat = DB::table('tower')
->select('tower.tenggat_izin')->get();
$curdate = Carbon::now();
return view('tower_kecamatan', compact('region','data','tenggat'));
}