File tree Expand file tree Collapse file tree 2 files changed +14
-17
lines changed Expand file tree Collapse file tree 2 files changed +14
-17
lines changed Original file line number Diff line number Diff line change 2020use MongoDB \BSON \UTCDateTime ;
2121use function uniqid ;
2222
23- /**
24- * @method void unset(string|string[] $columns) Remove one or more fields.
25- */
2623abstract class Model extends BaseModel
2724{
2825 use HybridRelations, EmbedsRelations;
@@ -341,8 +338,21 @@ public function offsetSet($offset, $value): void
341338 *
342339 * @param string|string[] $columns
343340 * @return void
341+ *
342+ * @deprecated Use unset() instead.
344343 */
345344 public function drop ($ columns )
345+ {
346+ $ this ->unset ($ columns );
347+ }
348+
349+ /**
350+ * Remove one or more fields.
351+ *
352+ * @param string|string[] $columns
353+ * @return void
354+ */
355+ public function unset ($ columns )
346356 {
347357 $ columns = Arr::wrap ($ columns );
348358
@@ -560,19 +570,6 @@ protected function isGuardableColumn($key)
560570 return true ;
561571 }
562572
563- /**
564- * @inheritdoc
565- */
566- public function __call ($ method , $ parameters )
567- {
568- // Unset method
569- if ($ method == 'unset ' ) {
570- return $ this ->drop (...$ parameters );
571- }
572-
573- return parent ::__call ($ method , $ parameters );
574- }
575-
576573 /**
577574 * @inheritdoc
578575 */
Original file line number Diff line number Diff line change @@ -511,7 +511,7 @@ public function testUnsetAndSet(): void
511511 $ this ->assertTrue ($ user ->originalIsEquivalent ('note1 ' ));
512512
513513 // Unset the value
514- unset( $ user[ 'note1 ' ] );
514+ $ user-> unset ( 'note1 ' );
515515 $ this ->assertFalse (isset ($ user ->note1 ));
516516 $ this ->assertNull ($ user ['note1 ' ]);
517517 $ this ->assertFalse ($ user ->originalIsEquivalent ('note1 ' ));
You can’t perform that action at this time.
0 commit comments