app/Http/Controllers/PatientController.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()
    {
        $title = 'Patients Information';
        $user_id = Auth::user()->id;
        if(Auth::user()->roles()->first()->role == 'User'):
            $patient = Patient::where('user_id', $user_id)->get();
        else:
            $patient = Patient::latest()->get();
        endif;
        return view('patient.index', compact('title','patient'));
    }
public function index ( ) { $ title = 'Patients Information' ; $ user_id = Auth :: user ( ) -> id ; if ( Auth :: user ( ) -> roles ( ) -> first ( ) -> role == 'User' ) : $ patient = Patient :: where ( 'user_id' , $ user_id ) -> get ( ) ; else : $ patient = Patient :: latest ( ) -> get ( ) ; endif ; return view ( 'patient.index' , compact ( 'title' , 'patient' ) ) ; }
Display a listing of the resource.
Display a listing of the resource .