Skip to content

Model::updateOrInsert not return a bool but is a Builder #56664

@HotHat

Description

@HotHat

Laravel Version

11.29.0

PHP Version

8.2.12

Database Driver & Version

No response

Description

$bool = Model
           ::query()
           ->updateOrInsert($condition, $data);
  

   source file: vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php: 3898
   /**
    * Insert or update a record matching the attributes, and fill it with values.
    *
    * @param  array  $attributes
    * @param  array|callable  $values
    * @return bool
    */
   public function updateOrInsert(array $attributes, array|callable $values = []){}

$bool is not a bool but is a \Illuminate\Database\Eloquent\Builder Object

Steps To Reproduce

#0 \vendor\laravel\framework\src\Illuminate\Support\Traits\ForwardsCalls.php(23): Illuminate\Database\Query\Builder->updateOrInsert(Array, Array)
#1 \vendor\laravel\framework\src\Illuminate\Database\Eloquent\Builder.php(2041): Illuminate\Database\Eloquent\Builder->forwardCallTo(Object(Illuminate\Database\Query\Builder), 'updateOrInsert', Array)
#2 \app\Domain\QuarterlyCompServiceFee\Repositories\QuarterlyRepo.php(150): Illuminate\Database\Eloquent\Builder->__call('updateOrInsert', Array)
#3 \app\Domain\QuarterlyCompServiceFee\Services\QuarterlyService.php(49): App\Domain\QuarterlyCompServiceFee\Repositories\QuarterlyRepo->addorupdate(Array, Array)

\Illuminate\Database\Eloquent\Builder::__call
public function __call($method, $parameters)
{
    ....
    $this->forwardCallTo($this->query, $method, $parameters);

    return $this;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions