📜  laravel 查询生成器 sum - PHP 代码示例

📅  最后修改于: 2022-03-11 14:53:48.180000             🧑  作者: Mango

代码示例2
$purchases = DB::table('transactions')
    ->join('categories', 'transactions.category_id', '=', 'categories.id')
    ->where('categories.kind', '=', 1)
    ->sum('transactions.amount');