How can I send request via console commands in laravel 5.1 ? I need to pass API request to controller in same folder project, my first attempt is using guzzle :
$gClient = new \GuzzleHttp\Client(['base_uri' => env('URL_AUTO_CONFIRM_PAYMENT')]);
$res = $gClient->post('api/payment/inquiries',
[
'headers'=> [
'Content-Type' => 'application/json',
'Accept' => 'application/json'
],
'json'=>[
'payment_method' => 'transfer',
'payment_channel' => 'bca',
'account_number' => $row->parameter['accountNo'],
'invoice_id' => $row->parameter['paymentInvoice'],
'amount' => (int)$row->parameter['totalCommission'],
'currency_code' => 'IDR',
'description' => 'Testing'
],
'http_errors' => false
]
);
but I think its not good because in same folder project, which can I call controller directly, but the problem is, my controller has been set to only receive $request not param (my_controller(Request $request)). So, how can I handle this ? It is ok using guzzle ? Or should I use another alternative ? Any advice will appreciate. Thanks
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire