Level 73
Please don't open new threads with the same question.
https://laracasts.com/discuss/channels/laravel/where-do-use-this-variable-please-help
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
hey i just want to know how to use this variable
$auth = $this->authenticate();
from the class i created
public function authenticate()
{
//declaring auth variables
$username = env('API_USERNAME');
$password = env('API_PASSWORD');
$auth = Http::withBasicAuth($username, $password);
return $auth;
}
how to implentent it $auth = $this->authenticate(); here???
$amount = $request->get('amount');
$client = new \GuzzleHttp\Client();
$response = $client->post(
' http://192.168.150.16:7585/api/v1/Transaction/GetTransactionNumber',
[
GuzzleHttp\RequestOptions::JSON => [
'Amount' => $amount,
'something' => '1',
'Description' => 'desc',
]
]
Please or to participate in this conversation.