Archived
lastest
This commit is contained in:
1 parent
620fc5bda1
commit
bd3ef9f279
779 files changed
+202868
No files matched your search
Whitespace-only changes.
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class ItemModel extends model {
|
||||
protected $table = 'item';
|
||||
|
||||
public function getItem($itemId = false) {
|
||||
if ($itemId === false) {
|
||||
return $this->findAll();
|
||||
}
|
||||
|
||||
return $this->where(['itemId' => $itemId])->first();
|
||||
}
|
||||
|
||||
public function getCount() {
|
||||
return $this->db->count_all($this->table);
|
||||
}
|
||||
|
||||
public function getStar(?int $perPage = null): array
|
||||
{
|
||||
$this->builder()
|
||||
->select('item.*, star.star')
|
||||
->join('star', 'star.itemId = item.itemId');
|
||||
return [
|
||||
'star' => $this->paginate($perPage),
|
||||
'starpager' => $this->pager,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user