Aronaman
1 month ago
114
1
Laravel

how to trigger both create and api request

Posted 1 month ago by Aronaman

hello guys

while adding every new recordin DB, i want to send api request .

it is possible whie the user create new record using form can send api request same time??

    public function store(Request $request)
    { 
	$org=$request->all();
        $Org = Organization::create($org);

	// here i want to send api request like this

     $client = new \GuzzleHttp\Client(["base_uri" => "http://server.test"]);

       $response = $client->post("/api/post", $Org );//it should also return (problem 1)

//redirect the normal 
return redirect()->route('Orgs.index');

   }

how can i mange both return for api and normal ??

Please sign in or create an account to participate in this conversation.