Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel eloquent get 3 months

$dateS = Carbon::now()->startOfMonth()->subMonth(3);
$dateE = Carbon::now()->startOfMonth(); 
$TotalSpent = DB::table('orders')
->select('total_cost','placed_at')
->whereBetween('placed_at',[$dateS,$dateE])
->where(['deleted' => '0', 'delivery_address_id' => $DeliveryAddress->id])
->sum('total_cost');
Comment

PREVIOUS NEXT
Code Example
Php :: php remove notice session already been started 
Php :: echo session 
Php :: php Call to undefined function mb_convert_case() 
Php :: access config variable in codeigniter controller 
Php :: laravel debug 
Php :: laravel use model inside blade 
Php :: php check weekday of date 
Php :: php artisan services 
Php :: laravel 8 selecet the 2nd to the last record 
Php :: php read json request body 
Php :: how to get all roles in wordpress 
Php :: fix excel file wrong language php 
Php :: php loop backwards through array 
Php :: artisan cache clear 
Php :: laravel wherehas 
Php :: laravel make model and controller 
Php :: swich in php 
Php :: php stmt prepare error 
Php :: implode php 
Php :: tolower php 
Php :: how to install dompdf in laravel 
Php :: Using middleware auth laravel in controller constructor 
Php :: how to find the name of login user in laravel 
Php :: php string replace regex 
Php :: running a laravel app locally 
Php :: php prime numbers 
Php :: migration with seeder laravel 
Php :: how to redirect a particular user role to a page after login laravel 
Php :: php check if date is bigger than today 
Php :: get current route in blade laravel 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =