I have a model that has a relationship like this

```
public function users(){
    return $this->belongsToMany(User::class);
}
public function latestUrlStatus(){
    return $this->hasOne(UrlStatus::class)->latest();
}

```

from my controller i can save from `many to many relationship` like this (SUCCESS NO PROBLEM)

```
public function update(Request $request, $id)
{
    $updateUrl = Url::findOrFail($id);
    $updateUrl->url = $request->input('url');
    $updateUrl->description = $request->input('description');
    $updateUrl->users()->sync(array_pluck($request->input('selectedTags'), 'id'));
    $updateUrl->save();

        if($updateUrl){
            return new UrlsResource($updateUrl);
        }
}

```

but when i add this code to save from another relation

```
public function update(Request $request, $id)
{
    $updateUrl = Url::findOrFail($id);
    $updateUrl->url = $request->input('url');
    $updateUrl->description = $request->input('description');
    $updateUrl->users()->sync(array_pluck($request->input('selectedTags'), 'id'));
    $updateUrl->save();

    //THIS CODE UP TO LAST
    $httpCode = check_http_header($request->input('url'));
    $status = "UP";

    $url = Url::with('latestUrlStatus','users')->findOrfail($id);
    $updateUrl->latestUrlStatus()->status_code = $httpCode;
    $updateUrl->latestUrlStatus()->status = $status;
    $updateUrl->push();
    if($updateUrl){
       return new UrlsResource($updateUrl);
    }
}

```

it doesnt update the latest url status. I'm sorry just new to framework. Thanks in advance.