I want to have a variable that is filled with a query that is available for all views of my controller in cake php
$number = $this ->Mesas->find('all')
->where(['user_id =' => $this->Auth->user('id')])
->count();
$this->set('number');
$this->set('_serialize', ['number']);
I want to have available the variable $ number for all my views (currently I have copied that code in all my actions) but I just started with Cakephp and I want to learn how to handle it correctly.