1class StargazerButton extends \atk4\ui\Button {
2
3 public $model;
4 public $label;
5
6 function init() {
7 parent::init();
8
9 $this->add(new Button(['Stars', 'basic blue', 'icon'=>'star']));
10 $this->label = $this->add(new Label($model['stars'], ['basic blue left pointing']));
11
12 $this->on('click', function() {
13 $this->model['stars']++;
14 $this->model->save();
15 return $this->reload();
16 });
17 }
18}