codeigniter-base-model
codeigniter-base-model copied to clipboard
Feature request: get by date range
Something like this:
$from = strtotime('yesterday');
$to = strtotime('today');
$this->blog_model->get_by_date_range($from,$to)->limit(10);
This would look at 'created_at' and do the equivalent of this:
$this->db->where("UNIX_TIMESTAMP(created_at)>=".$from);
$this->db->where("UNIX_TIMESTAMP(created_at)<=".$to);
Maybe the third parameter can be optional for another date field instead.
$this->blog_model->get_by_date_range($from,$to,'updated_at')->limit(10);
Thanks for this project. Makes my CodeIgniter feel like Laravel. :)
I think this would be outside of the scope of a base model. Since your model extends the base model, this would be added to your model (as an extension).
If you use it often, a blog for example, the you could extend the base model with a blog base model (from which you would then extend with the model).
What Kyle said :-)
On 1 April 2014 18:48, Kyle B. Johnson [email protected] wrote:
I think this would be outside of the scope of a base model. Since your model extends the base model, this would be added to your model (as an extension).
If you use it often, a blog for example, the you could extend the base model with a blog base model (from which you would then extend with the model).
Reply to this email directly or view it on GitHubhttps://github.com/jamierumbelow/codeigniter-base-model/issues/164#issuecomment-39236046 .
Jamie Rumbelow [email protected]