0

I want get data with specific date (timestamp) in database, i use this method and everything fine ! Method:

public function getdatabyday() { 
$p = "zero";
 $day = date('Y-m-d ', strtotime($_GET['day']));
 $users = DB::select('select * from S where (`timestamp` like "'.$day.'%")' ); 
if (!$users)
{ return $p; } 
return $users; 
} 

I want add parameter "day" in this swagger (function) where i put date exemple (07-08-2020) in this parameter in swagger documentation and as well i get data from specific timestamp or day :

/**
     * @OA\Get(
     *
     *   path="/api/getdatabyday",
     *   summary="Get data",
     *   @OA\Response(
     *     response=200,
     *     description="successful operation",
     *   ),
     *     security={
     *         {"bearerAuth": {}}
     *     }
     * )
     */

And in Route :

Route::get('/getdatabyday','Api\AuthController@getdatabyday')->middleware('auth:api');

Any help with adding parameter day ?

2
  • Use laravel where clauses instead of yours. WhereDay laravel.com/docs/master/queries#where-clauses Commented Aug 6, 2020 at 19:57
  • This is not a solution to my problem. I just want the correct way to insert parameter in the swagger function only. Commented Aug 7, 2020 at 7:08

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.