mercredi 20 juillet 2022

Laravel 5.6 Error on clicking the Patient list when creating a new doctor account

question 1.I have a thesis project about a certain clinic, I have a default users in my database, The default doctor doesn't have any problems or errors, but when i create a new doctor account, and when i click the patient list I get this error

Undefined variable: patient (View:C:\Users\patri\OneDrive\Desktop\Megason_noOTP\resources\views\patient-management\list.blade.php)

Please help TIA!!

    enter code here


public function index(){
    $user = User::where('id', Auth::user()->id)->with('usertype','usertype.permissions')->get();
    $permissions = [];
    foreach($user[0]->usertype->permissions as $permission)
    {
        array_push($permissions, $permission->name);
    }

    $patients = $this->getPatients();

    $data = array(
        'permissions' => $permissions,
        'patients' => $patients
    );

    return view('patient-management.list')->with('data',$data);

}

public function getPatients(){
    if(Auth::user()->type == 2){
        return PatientDetail::where('doctor_id', Auth::user()->id)->with('doctor.doctorDetails','user')->get();
    }else if(Auth::user()->type == 3){
        return PatientDetail::where('user_id', Auth::user()->id)->with('doctor.doctorDetails','user')->get();
    }
    else{
        return PatientDetail::with('doctor.doctorDetails','user')->get();
    }
}


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/seHhpvR
via IFTTT

Aucun commentaire:

Enregistrer un commentaire