Search
 
SCRIPT & CODE EXAMPLE
 

PHP

Laravel Eloquent sum of multiplied columns

$amount = Transaction::select(DB::raw('sum(jumlah * harga) as total'))->get();
Comment

Laravel Eloquent sum of multiplied columns

$amount = Transaction::all()->sum(function($t){ 
    return $t->jumlah * $t->harga; 
});
Comment

Laravel Eloquent sum of multiplied columns

$amount = Transaction::sum(DB::raw('jumla * harga'));
Comment

PREVIOUS NEXT
Code Example
Php :: Add Recent Posts by Category Using PHP 
Php :: str_ireplace — Case-insensitive version 
Php :: <?php $a=2; if ($a1){ echo "more that 1"; }elseif{ echo "less than one"; } ? 
Php :: wordpress programmatically set acf taxonomy term 
Php :: one to one relationship laravel 
Php :: stupidity 
Php :: laravel faker car plate br 
Php :: IlluminateDatabaseQueryException SQLSTATE[HY000]: General error: 3780 Referencing column 
Php :: php json array push in js file 
Php :: with() multiple relationship 
Php :: php exttends 
Php :: Access directory above php 
Php :: laravel view 
Php :: @parent laravel 
Php :: get current date epoch php 
Php :: list.blade.php 
Php :: check backend post type 
Php :: php partisan run backup run 
Php :: redirect back in codeignitor 
Php :: laravel rename file if exists 
Php :: pass array from controller laravel with compact 
Php :: php artisan reset --force 
Php :: woocommerce disable payment method if coupon appied and total is 0 
Php :: Route::whereIn 
Php :: php zoom api start_time issue 
Php :: check value is email or mobilenumber using php 
Php :: laravel 8 storing dynamic checkbox integer value array 
Php :: how return cutomize error text the firstOrFail laravel exeption 
Php :: Remove images from the the_content() 
Php :: remove public from laravel url live 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =