jeudi 28 juillet 2016

Laravel number comparison in 'where' not working

I have a Laravel 5.1 app, and am having trouble with a 'where' with a numerical comparison. Specifically I am trying to do:



The SQL 'type' of paid_price is 'decimal(8,2)'. There are several Item rows where the paid_price is in fact greater than zero, but the code above just yields 0. Stuff like the below which don't rely on numerical comparisons works just fine - can you give me any tips on why the > doesn't work? Thanks a lot



The code for my Items class is below:

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Items extends Model {
protected $fillable =['gateway','paid_price','payment_date','auth_date','charge_date','refunded_date'];
protected $dates = ['payment_date','auth_date','charge_date','refunded_date'];
public function setUserIdAttribute($value)
{
    $this->attributes['user_id'] = $value ?: null;
}
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire