app/Http/Controllers/HomeController.php
//sort based on patient's firstname 
sort based on patient's firstname
sort based on patient ' s firstname
public function sort_firstname(){
        $patients = Patient::all()->toArray();
        usort($patients, array($this , "compare_firstname"));
        return $patients;
    }
public function sort_firstname ( ) { $ patients = Patient :: all ( ) -> toArray ( ) ; usort ( $ patients , array ( $ this , " compare_firstname " ) ) ; return $ patients ; }
sort based on patient's firstname
sort based on patient ' s firstname