Query Builder: Get max value of a field


// Using "max" method
$max = DB::table('users')->max('age');

// Using raw query and the "value" method
$max = DB::table('users')->select(DB::raw('max(age) as max_age'))->value('max_age');



Related Snippets

•  Database: Using PDO
•  Query Builder: Get single value of a field from one record
•  Database: Raw SQL Select Query
•  Form Tag
•  Form Control: Select - Dropdown
•  Form Control: Input Text