src/Repositories/Repository.php
public function storeChild($id, $relation, array $data)
    {
        $parent = $this->model->find($id);
        
        if (! $parent) {
            return null;
        }
        
        $resource = $parent->$relation()->create($data);
        
        return $resource;
    }
public function storeChild($id, $relation, array $data)
    {
        $parent = $this->model->find($id);
        
        if (! $parent) {
            return null;
        }
        
        $resource = $parent->$relation()->create($data);
        
        return $resource;
    }
Create child One-to-One OR Many-to-Many without Pivot data

@return \Illuminate\Database\Eloquent\Model;