-
-
Save possamai/d2975272e9b9ad21c9ed 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