सीधे मुख्य सामग्री पर जाएं

laravel sum collection

 laravel sum function return 0 if not found any row related to that query 

only need to check if it is greater to zero or not.


$wi_fresh = DB::table('table_name')->where('code', $val['code'])
->where('city', $warehouse)->where('car_type', 'fresh')
->sum('available_qty');




टिप्पणियाँ

इस ब्लॉग से लोकप्रिय पोस्ट

How to create resourcefull controller in laravel

Laravel helps make   the process easy using resource controllers.  Use the following artisan command to create resourcefull controller :  php artisan make:controller ResourceController --resource  Output: To create normal controller , use the following artisan command  php artisan make:controller TestController