0

I’m building a Laravel API, and I need to implement a logic where:

First, I check if a particular record exists in the database table 1.If the record exists, I want to call an external update API with the request data. 2.If no record exists, I want to create a new record using the store method.

note:: I want to call the api for update.

I did get the wanted ouptput with calling the update method in the store controller which works fine for example something like this:

$videoAlbum=VideoAlbum::first();
if ($videoAlbum) {
    $updateRequest = new UpdateVideoAlbumAPIRequest();
    $updateRequest->merge($request->all());
    return $this->update($videoAlbum->album_id, $updateRequest); // Reverse the parameter order
}  

now i want a different approach like instead of method call i want to hit the api insted like usally do in the update request in postman

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.