Created
July 23, 2015 02:21
-
-
Save anonymous/1f056b1093852a901606 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?PHP | |
namespace App\Model\Table\Extra; | |
use Cake\ORM\Query | |
trait DatesTrait{ | |
public function findSeteDias(Query $query,array $options){ | |
$alias = $this->alias(); | |
$query->where([ | |
"{$alias}.data >"=>date('Y-m-d',strtotime("-7 days")), | |
"{$alias}.data <"=>"NOW()", | |
]); | |
return $query; | |
} | |
public function findTrintaDias(Query $query,array $options){ | |
$alias = $this->alias(); | |
$query->where([ | |
"{$alias}.data >"=>date('Y-m-d',strtotime("-30 days")), | |
"{$alias}.data <"=>"NOW()" | |
]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment