dimanche 6 décembre 2020

I want to use date filter in laravel 8 but data is not coming between from_date AND to_date

Controller name - ProductController i am searching data from multiple table with Scheduling_date_time (totime) Column

public function search_pending(Request $request) {

     if ($request->filled('page')) {
         $page = $request->page;
     } else {
         $page = 1;
     }

     $size = 10;
  

     $from_date = $request->input('from_date');
     $to_date = $request->input('to_date');

    $pending_pickup = collect(DB::connection('mysql2')->select("SELECT irp.remark1 AS 'ref_no', pr.pickupRequestNo AS 'pickup_req_no', ccp.firstName AS 'customer_name', ccp.phone AS 'contact_no', CONCAT(ca.address,' ', ca.addressLineTwo) AS 'address', ca.pinCode AS 'pincode', ca.city AS 'city', ca.state AS 'state', pr.toTime AS 'scheduled_date', FROM_UNIXTIME(pr.createdOn, '%Y-%m-%d %h:%i:%s ') AS 'created_datetime', pr.`comment` AS 'comment'
    FROM exigo.pickupRequest pr
    LEFT OUTER
    JOIN exigo.clientContactPerson ccp ON (pr.clientId=ccp.clientId AND pr.clientContactId=ccp.id)
    LEFT OUTER
    JOIN exigo.clientAddress ca ON (ccp.clientId=ccp.clientId AND ccp.addressId=ca.id)
    LEFT OUTER JOIN exigo.inspectionReqProduct irp ON (pr.clientId=irp.clientId AND pr.id=irp.inspectionReqId)
    WHERE pr.clientId=560 AND pr.prRequestStage=0 AND str_to_date(pr.toTime, '%d-%m-%Y') BETWEEN $request->input('from_date') AND $request->input('to_date')
    ORDER BY pr.id DESC"));


     $pending_pickup = new LengthAwarePaginator(
         $query->forPage($page, $size),
        $query->count(),
        $size,
        $page,
         ['path' => url('pickup_pending')]
     );
     return view('pickup_pending', compact('pending_pickup'));

}


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire