I’m trying to fetch rows based on the "created_at" field that are older than (for example) 30 days

  laravel, laravel-query-builder, php

I’m trying to fetch rows based on the created_at field that are older than (for example) 30 days.

I’m using Laravel Eloquent. Can somebody help me with this?

I want to change the text in crud to be red here is my code

public function   get_list_credit(Request $request)
{

    $resultat=tbl_depot::whereEtatservi('Etatservi'== 0) 
               ->orderBy('id','DESC')->get(); 

   if('created_at' >= Carbon::now()){
   
   }else{

   }
    return response()->json(['data'=>$resultat ]);
}

Source: Laravel

Leave a Reply