File tree Expand file tree Collapse file tree 3 files changed +29
-0
lines changed
src/Jenssegers/Mongodb/Eloquent Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -473,6 +473,17 @@ protected function getRelationsWithoutParent()
473
473
return $ relations ;
474
474
}
475
475
476
+ /**
477
+ * Checks if column exists on a table. As this is a document model, just return true. This also
478
+ * prevents calls to non-existent function Grammar::compileColumnListing()
479
+ * @param string $key
480
+ * @return bool
481
+ */
482
+ protected function isGuardableColumn ($ key )
483
+ {
484
+ return true ;
485
+ }
486
+
476
487
/**
477
488
* @inheritdoc
478
489
*/
Original file line number Diff line number Diff line change @@ -722,4 +722,11 @@ public function testTruncateModel()
722
722
723
723
$ this ->assertEquals (0 , User::count ());
724
724
}
725
+
726
+ public function testGuardedModel ()
727
+ {
728
+ Guarded::create (['var ' => 'val ' ]);
729
+
730
+ $ this ->assertEquals (1 , Guarded::count ());
731
+ }
725
732
}
Original file line number Diff line number Diff line change
1
+ <?php
2
+ declare (strict_types=1 );
3
+
4
+ use Jenssegers \Mongodb \Eloquent \Model as Eloquent ;
5
+
6
+ class Guarded extends Eloquent
7
+ {
8
+ protected $ connection = 'mongodb ' ;
9
+ protected $ collection = 'guarded ' ;
10
+ protected $ guarded = ['foobar ' ];
11
+ }
You can’t perform that action at this time.
0 commit comments