I heed two variables storing the maximum id from a table, and the minimum id from the same table.
the first id is easy to be taken ,using find() and a query like
$first = Model::factory('product')->sale($sale_id)->find();
but how can i retrieve the last id? is there a sorting option in the Kohana 3 ORM?
thanks!
Doing like this, I suppose you’ll be :
Ideally, you should be doing an SQL query that uses the
MAX()or theMIN()function — a bit like this :Not sure how to do that with Kohana, but this topic on its forum looks interesting.