cakephp3 を勉強中です。
cakephp3 にて
Users Table id : 1 name : sample company_id :1 id : 2 name : sample02 company_id :1 id : 3 name : sample03 company_id :2 id : 4 name : sample04 company_id :4
上記のようなテーブルをbake しindexを表示すると すべてのレコードが表示されます。
ログイン情報よりcompany_id
で振り分けたものを表示したいです。
public function index() { $this->paginate = [ 'contain' => ['Companies', 'Users', 'Statuses'], 'finder' => [ 'tagged' => $this->request->getSession()->read('Auth.User.company_id') ] ]; $banners = $this->paginate($this->Banners); $this->set(compact('banners')); }
カスタムファインダー?というもので設定をすればいいのでしょうか。
https://book.cakephp.org/3.0/ja/controllers/components/pagination.html
を参考にいろいろやってみたのですが、仕組み自体が理解できていないのかわからなくなってしまいご質問させていただきました。
初歩的なご質問で恐縮ではありますが、ご教授お願いいたします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。