Page 333 of 211,266, showing 20 records out of 4,225,311 total, starting on record 6,641, ending on 6,660
# | Username | Text | |
---|---|---|---|
# | Aug 9th 2008, 04:00 | skua | then $this->Medicine->latest_stock(); |
# | Aug 9th 2008, 04:00 | skua | in your controller to return data |
# | Aug 9th 2008, 04:01 | ichsan | So, this function is a class method? not an instance method? |
# | Aug 9th 2008, 04:03 | skua | you want to create a model function to return an array of the lastest stock directly from the controller right ? |
# | Aug 9th 2008, 04:03 | ichsan | No |
# | Aug 9th 2008, 04:03 | ichsan | Say, I have a medicine named xobile |
# | Aug 9th 2008, 04:04 | ichsan | $xobile = new Medicine(xobile) |
# | Aug 9th 2008, 04:04 | ichsan | $xobile->current_stock() |
# | Aug 9th 2008, 04:04 | ichsan | more or less |
# | Aug 9th 2008, 04:04 | ichsan | .. |
# | Aug 9th 2008, 04:05 | ichsan | Because, I see that CakePHP model is created from array |
# | Aug 9th 2008, 04:05 | ichsan | $xobile = Medicine->find(3); |
# | Aug 9th 2008, 04:05 | skua | hmmm create a model named Medicine.php |
# | Aug 9th 2008, 04:06 | ichsan | skua: Ok then? |
# | Aug 9th 2008, 04:06 | skua | then in your controller you do a $this->Medicine->find('all', array(yourconditions) ); |
# | Aug 9th 2008, 04:07 | skua | that will give you an array with results you need |
# | Aug 9th 2008, 04:07 | ichsan | No, the result is not an array |
# | Aug 9th 2008, 04:07 | ichsan | The function is meant to return the stock of that medicine. The xobile medicine |
# | Aug 9th 2008, 04:07 | ichsan | not other medicine |
# | Aug 9th 2008, 04:08 | skua | you should use countercache |