report livechat
This commit is contained in:
@@ -15,14 +15,24 @@ class LivechatController extends Controller
|
||||
* Display a listing of the resource.
|
||||
* @return Renderable
|
||||
*/
|
||||
public function index()
|
||||
public function index(Request $request)
|
||||
{
|
||||
$startDate = '2023-01-01';
|
||||
$endDate = '2023-08-01';
|
||||
$livechat = Livechat::with('doctor.user', 'doctor.speciality', 'appointment.appointmentDetail', 'healthCare')
|
||||
->where('nIDAppointment', '!=', null)->where('nIDAppointment', '!=', '');
|
||||
$startDate = $request->startDate;
|
||||
$endDate = $request->endDate;
|
||||
|
||||
$livechat = Livechat::with('doctor.user', 'doctor.speciality', 'appointment.appointmentDetail', 'healthCare')
|
||||
->where('nIDAppointment', '!=', null)
|
||||
->where('nIDAppointment', '!=', '');
|
||||
|
||||
|
||||
if ($startDate){
|
||||
$livechat = $livechat->where('dCreateOn', '>=', $startDate);
|
||||
}
|
||||
|
||||
if ($endDate){
|
||||
$livechat = $livechat->where('dCreateOn', '<=', $endDate);
|
||||
}
|
||||
|
||||
|
||||
$livechat = $livechat->latest()->paginate(15);
|
||||
|
||||
return response()->json(Helper::paginateResources(LivechatResource::collection($livechat)));
|
||||
|
||||
Reference in New Issue
Block a user