I have two projects in Laravel .Let's consider Project A and Project B and their databases respectively pA & pB. At one point i needed a communication channel between both projects so i wrote a api in Project A so that Project B could access data from that api . I tested my api in postman it worked fine . so spoof the same Curl Request from Project B . The result was unexpected on further debugging i found that on Curl request Project A started using database of project B . It doesn't make any sense both projects are stand alone on their own . For further investigation i changed the api code of project B to just print database name and now it was confirm that same code was showing different results When i requested from postman it pA as expected but from Curl request it resulted in pB
here's my api method in Project A
public function nextmlaNotify(){
dd(\DB::getDatabaseName(););
}
and this how i am requesting data from Project B
public function testing(){
$ch = curl_init();
$body=['name'=>'Prince'];
curl_setopt($ch, CURLOPT_URL,"projectA/emsapi/nextmla/notifier");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
http_build_query($body));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec ($ch);
curl_close ($ch);
return $output;
}
I have no clue what i am doing wrong i tried everything