I have these endpoint to consume in my controller. How do I consume them without needing to GuzzleHttp or Curl ?
I am doing this ( as an example ) :
$wean_data = app('App\Http\Controllers\Api\AnimalWeaningsApiController')->assignAllCalculations($request);
My problem here is the $request, since all APIs are expecting a ( Request $request ), I cannot in my current controller do this :
$params = $request->all();
$wean_data = app('App\Http\Controllers\Api\AnimalWeaningsApiController')->assignAllCalculations($request);
I want to process the $params, before each api and after I call them, meaning,
$params = $request->all();
// do something with $params
// consume API
$params = app('App\Http\Controllers\Api\AnimalWeaningsApiController')->assignAllCalculations($params);
// do something with $params
// comsume the second api, do something with the data and again call the third.
Route::post('weaning-all-calculations/assign', 'AnimalWeaningsApiController@assignAllCalculations');
Route::post('yearling-all-calculations/assign', 'AnimalYearlingsApiController@assignAllCalculations');
Route::post('ultrasound-all-calculations/assign', 'AnimalUltrasoundsApiController@assignAllCalculations');