Home > Enterprise >  Laravel-Auditing is not working without any errors
Laravel-Auditing is not working without any errors

Time:10-14

I've recently installed Builder vs. Eloquent

So, maybe you need to change your code to:

$setting = Setting::where('id', 1)->firstOrFail();
$setting->update([
  'expansion_id' => $request['expansion_id'],
  'season' => $request['season'],
  'advertiser_app' => $request['advertiser_app'],
  'pvp_app' => $request['pvp_app'],
  'raid_app' => $request['raid_app'],
  'version' => $request['version']
]);

CodePudding user response:

now I have another problem -_-

this is my controller:

$sql = Raid::findOrFail($request['id']);
$sql = $sql->update($request->all());

I have a array in my table , after update value will be like this:

"{\"Plate\":0,\"Cloth\":0,\"Mail\":0,\"Leather\":0}"

but it should be:

{"Plate":"0","Cloth":"0","Mail":"0","Leather":"0"}

so I will get an error before this , I was updating like this and it was ok:

$sql = Raid::where('id', $request['id'])->update($request->all());

and this is my mode (traders and class_traders is fields that I have problem with):

    use SoftDeletes;

    use \OwenIt\Auditing\Auditable;

    protected $table = 'raid';

    protected $dates = ['date_and_time','deleted_at'];

    protected $fillable = [
      'admin_id', '....
    ];

    protected $casts = [
        'bosses' => 'array',
        'traders' => 'array',
        'class_traders' => 'array',
        'boosters' => 'array',
    ];
  • Related