File tree Expand file tree Collapse file tree 1 file changed +7
-15
lines changed Expand file tree Collapse file tree 1 file changed +7
-15
lines changed Original file line number Diff line number Diff line change @@ -49,24 +49,16 @@ abstract class Model extends \Jenssegers\Eloquent\Model {
4949 */
5050 public function getIdAttribute ($ value )
5151 {
52- if ($ value ) {
53- // Return _id as string
54- if ($ value instanceof MongoId) {
55- return (string ) $ value ;
56- }
57-
58- return $ value ;
52+ if (!$ value && array_key_exists ('_id ' , $ this ->attributes )) {
53+ $ value = $ this ->attributes ['_id ' ];
5954 }
6055
61- if (array_key_exists ('_id ' , $ this ->attributes ))
62- {
63- // Return _id as string
64- if ($ this ->attributes ['_id ' ] instanceof MongoId) {
65- return (string ) $ this ->attributes ['_id ' ];
66- }
67-
68- return $ this ->attributes ['_id ' ];
56+ // Return _id as string
57+ if ($ value instanceof MongoId) {
58+ return (string ) $ value ;
6959 }
60+
61+ return $ value ;
7062 }
7163
7264 /**
You can’t perform that action at this time.
0 commit comments