Thursday, February 22, 2018

Retrieve data from the database using Eloquent between two dates - development

Retrieve data from the database using Eloquent between two dates

I’m having trouble retrieving data from the database using Eloquent. I am trying to retrieve all data between two dates (created_at field).

I’ve done this:

 public function search(Request $request){
        $start_date  = $request->get('start_date');
        $end_date = $request->get('end_date');

        $getinfo =  DB::table('media')
            ->join('content_forms', 'media.id', "=", 'content_forms.media_id')
            ->whereBetween('Date_Occured',[$start_date, $end_date])
            ->get();
        dd($getinfo);
    }



from Laravel Questions and Answers https://laravelquestions.com/php/retrieve-data-from-the-database-using-eloquent-between-two-dates/
via Lzo Media

No comments:

Post a Comment