0

I been trying to update data in my db with a model like:

<?php

namespace App\Models\Oracle;

use Awobaz\Compoships\Compoships;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class MY_MODEL extends Model
{
    use HasFactory, Compoships;
    protected $connection = 'oracle';
    protected $table = 'MY_TABLE';
    protected $primaryKey = ['key1', 'key2', 'key3', 'key4'];
    public $incrementing = false;
    public $timestamps = false;
}

I can´t remove the composite key in the data base. When I want to update data I´m using this:


 public function update(
    Request $request,
    $key1,
    $key2,
    $key3,
    $key4
  ) {

    $tarifa =
      MY_MODEL::where('key1', $key1)
      ->where('key2', $key2)
      ->where('key3', $key3)
      ->where('key4', $key4)
      ->first()->update($request->all());

    return $tarifa;
}

And the result gives me:

ErrorException: Illegal offset type in file \vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php on line 1125
...

0 Answers0