1 | <?php |
||
8 | class MultiSelect extends Select |
||
9 | { |
||
10 | /** |
||
11 | * @var bool |
||
12 | */ |
||
13 | protected $taggable = false; |
||
14 | |||
15 | /** |
||
16 | * @var \Closure |
||
17 | */ |
||
18 | protected $pivotCallback; |
||
19 | |||
20 | /** |
||
21 | * @var bool |
||
22 | */ |
||
23 | protected $deleteRelatedItem = false; |
||
24 | |||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $view = 'form.element.select'; |
||
29 | |||
30 | /** |
||
31 | * @return string |
||
32 | */ |
||
33 | public function getName() |
||
37 | |||
38 | /** |
||
39 | * @return array |
||
40 | */ |
||
41 | public function getValueFromModel() |
||
54 | |||
55 | /** |
||
56 | * @return bool |
||
57 | */ |
||
58 | public function isTaggable() |
||
62 | |||
63 | /** |
||
64 | * @return $this |
||
65 | */ |
||
66 | public function taggable() |
||
72 | |||
73 | /** |
||
74 | * @return \Closure |
||
75 | */ |
||
76 | public function getPivotCallback() |
||
80 | |||
81 | /** |
||
82 | * @param \Closure $callable |
||
83 | * @return $this |
||
84 | */ |
||
85 | public function setPivotCallback(\Closure $callable) |
||
91 | |||
92 | /** |
||
93 | * @return bool |
||
94 | */ |
||
95 | public function isDeleteRelatedItem() |
||
99 | |||
100 | /** |
||
101 | * @return $this |
||
102 | */ |
||
103 | public function deleteRelatedItem() |
||
109 | |||
110 | /** |
||
111 | * @return array |
||
112 | */ |
||
113 | public function toArray() |
||
134 | |||
135 | /** |
||
136 | * @param \Illuminate\Http\Request $request |
||
137 | * |
||
138 | * @return void |
||
139 | */ |
||
140 | public function save(\Illuminate\Http\Request $request) |
||
146 | |||
147 | /** |
||
148 | * @param \Illuminate\Http\Request $request |
||
149 | * |
||
150 | * @return void |
||
151 | */ |
||
152 | public function afterSave(\Illuminate\Http\Request $request) |
||
175 | |||
176 | /** |
||
177 | * @param \Illuminate\Database\Eloquent\Relations\BelongsToMany $relation |
||
178 | * @param array $values |
||
179 | * |
||
180 | * @return void |
||
181 | */ |
||
182 | protected function syncBelongsToManyRelation( |
||
202 | |||
203 | /** |
||
204 | * @param \Illuminate\Database\Eloquent\Relations\HasMany $relation |
||
205 | * @param array $values |
||
206 | */ |
||
207 | protected function deleteOldItemsFromHasManyRelation( |
||
224 | |||
225 | /** |
||
226 | * @param \Illuminate\Database\Eloquent\Relations\HasMany $relation |
||
227 | * @param array $values |
||
228 | */ |
||
229 | protected function attachItemsToHasManyRelation( |
||
250 | } |
||
251 |
PHP has two types of connecting operators (logical operators, and boolean operators):
and
&&
or
||
The difference between these is the order in which they are executed. In most cases, you would want to use a boolean operator like
&&
, or||
.Let’s take a look at a few examples:
Logical Operators are used for Control-Flow
One case where you explicitly want to use logical operators is for control-flow such as this:
Since
die
introduces problems of its own, f.e. it makes our code hardly testable, and prevents any kind of more sophisticated error handling; you probably do not want to use this in real-world code. Unfortunately, logical operators cannot be combined withthrow
at this point:These limitations lead to logical operators rarely being of use in current PHP code.