blob: 087761992d99a433475ab098381b99da2e8b5448 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
<?php
namespace app\models;
class Anime extends \lithium\data\Model {
protected $_meta = array('key' => '_id', 'source' => 'anime');
public static function search($query, $page = 1, $by = 'title')
{
$defaults = array(
'limit' => 20
);
$limit = 20;
$content = self::find('all',
array(
'conditions' => array(
$by => array('like' => $query)
),
'limit' => $limit,
'page' => $page
));
$total = Anime::count(array('title' => array('like' => $query)));
return compact('content', 'by', 'limit', 'total', 'page');
}
}
|