bugs fix
This commit is contained in:
@@ -240,25 +240,31 @@ class RequestLogController extends Controller
|
|||||||
return Helper::responseJson(data: $manipulatedIcds);
|
return Helper::responseJson(data: $manipulatedIcds);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function codeLog(Request $request){
|
public function codeLog(Request $request)
|
||||||
$codeLogs = RequestLog::with(['member'])->when($request->search, function ($q, $search) {
|
{
|
||||||
$q->where('code', 'LIKE', "%".$search."%");
|
$codeLogs = RequestLog::with(['member'])
|
||||||
$q->orWhereHas('member', function ($subQuery) use ($search) {
|
->when($request->search, function ($q) use ($request) {
|
||||||
$subQuery->where('name', 'LIKE', "%".$search."%");
|
$q->where('code', 'LIKE', "%{$request->search}%")
|
||||||
});
|
->orWhereHas('member', function ($subQuery) use ($request) {
|
||||||
})
|
$subQuery->where('name', 'LIKE', "%{$request->search}%");
|
||||||
->get();
|
});
|
||||||
|
})
|
||||||
|
->whereHas('member', function ($subQuery) {
|
||||||
|
$subQuery->whereNull('deleted_at');
|
||||||
|
})
|
||||||
|
->get();
|
||||||
|
|
||||||
$manipulatedIcds = $codeLogs->map(function ($codeLog) {
|
$manipulatedIcds = $codeLogs->map(function ($codeLog) {
|
||||||
// Contoh manipulasi, tambahkan atau ubah properti sesuai kebutuhan
|
|
||||||
return [
|
return [
|
||||||
'value' => $codeLog->id, // Ganti dengan properti yang sesuai dari model Icd
|
'value' => $codeLog->id,
|
||||||
'label' => $codeLog->code . ' - ' .$codeLog->member->name, // Ganti dengan properti yang sesuai dari model Icd
|
'label' => $codeLog->code . ' - ' . ($codeLog->member->name ?? 'Unknown'),
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
return Helper::responseJson(data: $manipulatedIcds);
|
return Helper::responseJson(data: $manipulatedIcds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function hospitals(){
|
public function hospitals(){
|
||||||
$organizations = Organization::query()
|
$organizations = Organization::query()
|
||||||
->where([
|
->where([
|
||||||
|
|||||||
Reference in New Issue
Block a user