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 {
49
49
*/
50
50
public function getIdAttribute ($ value )
51
51
{
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 ' ];
59
54
}
60
55
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 ;
69
59
}
60
+
61
+ return $ value ;
70
62
}
71
63
72
64
/**
You can’t perform that action at this time.
0 commit comments