I have 2 date columns in the users table of laravel 5.0. The schema is:
users * id * email * activated_on * deactivated_on
I want to query if the user is activated so I have the following scope function:
public function scopeActivated($query){
$now = date('Y-m-d');
return $query->whereBetween('activated_on', ['deactivated_on', $now]);
}
The query that this generates is that it compares the column activated_on to the string deactivated_on.
Is there a way to tell eloquent to compare the 2 columns?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire