1 | <?php |
||
7 | trait HasAuthorizations |
||
8 | { |
||
9 | /** |
||
10 | * Flag to check if user is authorized to use the button. |
||
11 | * |
||
12 | * @var bool |
||
13 | */ |
||
14 | protected $authorized = true; |
||
15 | |||
16 | /** |
||
17 | * Make a button if condition is true. |
||
18 | * |
||
19 | * @param bool|callable $condition |
||
20 | * @param string|array $options |
||
21 | * @return static |
||
22 | */ |
||
23 | public static function makeIf($condition, $options) |
||
31 | |||
32 | /** |
||
33 | * Make a button if condition is true. |
||
34 | * |
||
35 | * @param string $permission |
||
36 | * @param string|array $options |
||
37 | * @param Authorizable|null $user |
||
38 | * @return static |
||
39 | */ |
||
40 | public static function makeIfCan($permission, $options, Authorizable $user = null) |
||
52 | |||
53 | /** |
||
54 | * Set authorization status of the button. |
||
55 | * |
||
56 | * @param bool|callable $bool |
||
57 | * @return static |
||
58 | */ |
||
59 | public function authorized($bool) |
||
65 | |||
66 | /** |
||
67 | * Convert the Fluent instance to an array. |
||
68 | * |
||
69 | * @return array |
||
70 | */ |
||
71 | public function toArray() |
||
79 | } |
||
80 |