samedi 3 février 2018

Laravel - Eloquent Update 1 less than it says?

So I am using Laravel 5.5 and I am having the weirdest issue. My Database is a MySQL database and whenever I run my query, Debugbar states the correct query however whenever I check the actual database the value is one less than it should.

For example, I gave it the following query (Shown in DebugBar):

update `whitelist` set `AdminRank` = '5' where `PlayerUID` = '\"76561198066771722\"'

Created using eloquent in the following statement :

DB::table('whitelist')
      ->where('PlayerUID', $formData['playerID'])
      ->update(["$colName"=> $rank]);

However in the database the 'AdminRank' displays as a value of '4' rather than 5. I have come to a complete loose end here as I have no idea what could be causing this. Im tempted to simply add 1 to all my values before updating however I really want to avoid that as it is super hacky.

Side Note : Yes the Player ID is supposed to be in double quotes like that, its a long story but that is not the issue..



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire