@Snapey I take a look and i tought "firstOrNew()" was behind the firstOrCreate
But the "firstOrCreate" is call behind the scene, and this methode do not required any mandatory parameter.
The thing is, we must give an "attributes" parameter to updateOrCreate(), so when we write the code under, the methode will search a record related to the array we gave. That's why this version doesn't work
$program->service()->updateOrCreate($data_service); //FAILED
I tried and this one work's good
$program->service()->updateOrCreate(array(), $data_service);
An improvement suggestion, if the attributes parameters can be null
public function updateOrCreate(array $attributes = [], array $values = [])
With the use of named parameters in php 8 we can do
$program->service()->updateOrCreate(values:$data_service);
But this need more reflections