resources/views/pages/consultations/s1.blade.php
/**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
Display a listing of the resource.
@return \Illuminate\Http\Response
Display a listing of the resource . @return \ Illuminate \ Http \ Response
public function index()
    {
        $registration = Registration::with('patient')
            ->where('vitals',1)
            ->where('consult',0)
            ->whereDate('created_at', Carbon::today())
            ->limit(1)
            ->get();
        $allRegistrations=0;
        if (count($registration) == 1){
            $allRegistrations = Registration::where('patient_id',$registration[0]->patient->id)->get();
            $getVitals = Vital::where('patient_id',$registration[0]->patient_id)
                ->whereDate('created_at', Carbon::today())->get();
        }else{
            $getVitals =[];
        }
        $diagnosis = Diagnose::all();
        $drugs = Drug::with('drug_type')
            ->where('qty_in_stock','>',0)
            ->where('retail_price','>',0)->get();
        $charges = Charge::all();
        return view('pages.consultations.index')
            ->with('registration',$registration)
            ->with('getVitals',$getVitals)
            ->with('diagnosis',$diagnosis)
            ->with('drugs',$drugs)
            ->with('allRegistrations',$allRegistrations)
            ->with('charges',$charges);
    }
public function index ( ) { $ registration = Registration :: with ( 'patient' ) -> where ( 'vitals' , 1 ) -> where ( 'consult' , 0 ) -> whereDate ( 'created_at' , Carbon :: today ( ) ) -> limit ( 1 ) -> get ( ) ; $ allRegistrations = 0 ; if ( count ( $ registration ) == 1 ) { $ allRegistrations = Registration :: where ( 'patient_id' , $ registration [ 0 ] -> patient -> id ) -> get ( ) ; $ getVitals = Vital :: where ( 'patient_id' , $ registration [ 0 ] -> patient_id ) -> whereDate ( 'created_at' , Carbon :: today ( ) ) -> get ( ) ; } else { $ getVitals = [ ] ; } $ diagnosis = Diagnose :: all ( ) ; $ drugs = Drug :: with ( 'drug_type' ) -> where ( 'qty_in_stock' , '>' , 0 ) -> where ( 'retail_price' , '>' , 0 ) -> get ( ) ; $ charges = Charge :: all ( ) ; return view ( 'pages.consultations.index' ) -> with ( 'registration' , $ registration ) -> with ( 'getVitals' , $ getVitals ) -> with ( 'diagnosis' , $ diagnosis ) -> with ( 'drugs' , $ drugs ) -> with ( 'allRegistrations' , $ allRegistrations ) -> with ( 'charges' , $ charges ) ; }
Display a listing of the resource.
Display a listing of the resource .
//            ->orderBy('created_at','asc') // return $allRegistrations;