1 | <?php |
||
9 | class Button extends Fluent implements Arrayable |
||
10 | { |
||
11 | /** |
||
12 | * Flag to check if user is authorized to use the button. |
||
13 | * |
||
14 | * @var bool |
||
15 | */ |
||
16 | protected $authorized = true; |
||
17 | |||
18 | /** |
||
19 | * Make a button if condition is true. |
||
20 | * |
||
21 | * @param bool|callable $condition |
||
22 | * @param string|array $options |
||
23 | * @return Button |
||
24 | */ |
||
25 | public static function makeIf($condition, $options) |
||
33 | |||
34 | /** |
||
35 | * Make a new button instance. |
||
36 | * |
||
37 | * @param string|array $options |
||
38 | * @return Button |
||
39 | */ |
||
40 | public static function make($options = []) |
||
48 | |||
49 | /** |
||
50 | * Set authotization status of the button. |
||
51 | * |
||
52 | * @param bool|callable $bool |
||
53 | * @return $this |
||
54 | */ |
||
55 | public function authorized($bool) |
||
61 | |||
62 | /** |
||
63 | * Make a button if condition is true. |
||
64 | * |
||
65 | * @param string $permission |
||
66 | * @param string|array $options |
||
67 | * @param Authorizable|null $user |
||
68 | * @return Button |
||
69 | */ |
||
70 | public static function makeIfCan($permission, $options, Authorizable $user = null) |
||
82 | |||
83 | /** |
||
84 | * Set extend option value. |
||
85 | * |
||
86 | * @param string $value |
||
87 | * @return $this |
||
88 | */ |
||
89 | public function extend($value) |
||
95 | |||
96 | /** |
||
97 | * Set editor option value. |
||
98 | * |
||
99 | * @param string $value |
||
100 | * @return $this |
||
101 | */ |
||
102 | public function editor($value) |
||
108 | |||
109 | /** |
||
110 | * Set className option value. |
||
111 | * |
||
112 | * @param string $value |
||
113 | * @return $this |
||
114 | */ |
||
115 | public function className($value) |
||
121 | |||
122 | /** |
||
123 | * Set text option value. |
||
124 | * |
||
125 | * @param string $value |
||
126 | * @return $this |
||
127 | */ |
||
128 | public function text($value) |
||
134 | |||
135 | /** |
||
136 | * Convert the Fluent instance to an array. |
||
137 | * |
||
138 | * @return array |
||
139 | */ |
||
140 | public function toArray() |
||
148 | } |
||
149 |