vhost/app/Cells/BoardCell.php
2024-07-11 11:57:36 +09:00

47 lines
1.2 KiB
PHP

<?php
namespace App\Cells;
use App\Models\CategoryModel;
use App\Models\BoardModel;
use App\Cells\BaseCell;
class BoardCell extends BaseCell
{
private $_boardModel = null;
private function getBoardModel(): BoardModel
{
return $this->_boardModel = $this->_boardModel ?: new BoardModel();
}
public function information(array $cellDatas = [])
{
//dd($cellDatas);
helper('Board');
$cellDatas['currentCategory'] = $this->getCategoryModel()->getEntity([
'uid' => __FUNCTION__
]);
$cellDatas['entitys'] = $this->getBoardModel()->getEntitys([
'category' => $cellDatas['currentCategory']->getPrimaryKey()
]);
return view(
'Views/cells/board/' . $cellDatas['currentCategory']->getPrimaryKey(),
['cellDatas' => $cellDatas]
);
}
public function reference(array $cellDatas = [])
{
//dd($cellDatas);
helper('Board');
$cellDatas['currentCategory'] = $this->getCategoryModel()->getEntity([
'uid' => __FUNCTION__
]);
$cellDatas['entitys'] = $this->getBoardModel()->getEntitys([
'category' => $cellDatas['currentCategory']->getPrimaryKey()
]);
return view(
'Views/cells/board/' . $cellDatas['currentCategory']->getPrimaryKey(),
['cellDatas' => $cellDatas]
);
}
}