|
|
@@ -89,27 +89,35 @@ class RestfulapiController extends BaseController |
|
|
|
|
|
|
|
//get date and convert to ISO format |
|
|
|
$date = $request->date; |
|
|
|
// $date = Carbon::createFromFormat('Y-m-d', $request->date)->toDateString(); |
|
|
|
|
|
|
|
|
|
|
|
$compound = Compound::with('Faulty', 'Department', 'DeedLaw')->where('jenis', $jenis)->orWhere('jenis_n', $jenis) |
|
|
|
->orWhere(function($q) use |
|
|
|
($notice, $ic, $date, $jalan, $taman, $kawasan) { |
|
|
|
|
|
|
|
if(!empty($notice) && $notice != '-'){ |
|
|
|
$q = $q->where('non', $notice)->orWhere('kpd', $notice); |
|
|
|
|
|
|
|
$q = $q->where('non', 'like', $notice)->orWhere('kpd', 'like', $notice); |
|
|
|
} |
|
|
|
|
|
|
|
if(!empty($ic) && $ic != '-'){ |
|
|
|
$q = $q->where('identity', $ic); |
|
|
|
|
|
|
|
$q = $q->where('identity', 'like', $ic); |
|
|
|
} |
|
|
|
|
|
|
|
if(!empty($date)){ |
|
|
|
if(!empty($date) && $date != '-'){ |
|
|
|
|
|
|
|
$start = Carbon::createFromFormat('Y-m-d', $date)->startOfDay(); |
|
|
|
$end = Carbon::createFromFormat('Y-m-d', $date)->endOfDay(); |
|
|
|
|
|
|
|
$q = $q->whereBetween('created_at', [$start, $end]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if( !empty($kawasan) || !empty($taman) || !empty($jalan) ) |
|
|
|
{ |
|
|
|
$q = $q->where('nama_kawasan', $kawasan)->orWhere('nama_taman', $taman)->orWhere('nama_jalan', $jalan); |
|
|
|
} |
|
|
|
|
|
|
|
})->get(); |
|
|
|
|
|
|
|
} |
|
|
@@ -138,14 +146,14 @@ class RestfulapiController extends BaseController |
|
|
|
|
|
|
|
if (!empty($c->created_n)) |
|
|
|
{ |
|
|
|
$tarikh_n = Carbon::parse($c->created_c)->format("D, d M, 'y"); |
|
|
|
$tarikh_n = Carbon::parse('2020-09-11')->translatedFormat("l, d M, 'y"); |
|
|
|
$masa_n = Carbon::parse($c->created_c)->format("g:i A"); |
|
|
|
} |
|
|
|
|
|
|
|
if(!empty($c->created_c)) |
|
|
|
{ |
|
|
|
$tarikh = Carbon::parse($c->created_n)->format("D, d M, 'y"); |
|
|
|
$masa = Carbon::parse($c->created_n)->format("g:i A"); |
|
|
|
$tarikh = Carbon::parse('2020-09-11')->translatedFormat("l, d M, 'y"); |
|
|
|
$masa = Carbon::parse($c->created_c)->format("g:i A"); |
|
|
|
} |
|
|
|
|
|
|
|
//set default data to '-' if not present |