Application examples
Statistics on the number of orders
Solution
Use "aggregation query". Reference documentation
Backend code
Use model.
1. Query statement
$recordNum = \app\index\Model\Reservation::where('username','=',session('username'))->count();2. Pay the query result to the front desk
$this->assign([ 'recordNum'=>$recordNum, ]);

<p>A total of {$recordNum}</p>
Result
##Related recommendations: