/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { $doctors = Doctor::select(DB::raw("CONCAT(doctor_fname,' ', doctor_mname,' ',doctor_lname,' - ',(select med_specialty from medspecialties where id = medspecialty_id) ) AS full_name, id"))->lists('full_name', 'id'); $beds = Bed::vacant(); $visit_type = array('in_patient' => 'in patient', 'out_patient' => 'out patient'); //dd($doctors,$beds); return view('pages.Visit.admit', compact('doctors', 'beds', 'visit_type')); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $bed = Bed::findOrFail($id); $vacant = Visit::select('id')->where('bed_id', '>', $id)->exists(); if ($vacant) { $vacant = 'available'; } else { $vacant = 'occupied'; } return view('pages.beds.show', compact('bed', 'vacant')); }