MongoDBを使用してLaravelモデルでcreated_at
とupdated_at
プロパティにアクセスする際に問題があります。以下のように、データベース内の私の日付形式は次のとおりです。mongodbでlaravelのcreated_atとupdated_atの日付にアクセスできません
"created_at" : {
"sec" : NumberInt(1475126325),
"usec" : NumberInt(840000)
},
"updated_at" : {
"sec" : NumberInt(1475126325),
"usec" : NumberInt(840000)
},
私はMongoDBのクエリから次の結果を得る:
App\Modules\Admin\Models\Segment Object
(
[table:protected] => tbl_segment
[timestamps] => 1
[fillable:protected] => Array
(
[0] => name
[1] => created_at
[2] => updated_at
)
[collection:protected] =>
[primaryKey:protected] => _id
[parentRelation:protected] =>
[connection:protected] =>
[keyType:protected] => int
[perPage:protected] => 15
[incrementing] => 1
[attributes:protected] => Array
(
[_id] => MongoDB\BSON\ObjectID Object
(
[oid] => 57ecbefe15285745ba039871
)
[created_at] => Array
(
[sec] => 1475133182
[usec] => 832000
)
[updated_at] => Array
(
[sec] => 1475133182
[usec] => 832000
)
)
[original:protected] => Array
(
[_id] => MongoDB\BSON\ObjectID Object
(
[oid] => 57ecbefe15285745ba039871
)
[created_at] => Array
(
[sec] => 1475133182
[usec] => 832000
)
[updated_at] => Array
(
[sec] => 1475133182
[usec] => 832000
)
)
[relations:protected] => Array
(
)
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[appends:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[dates:protected] => Array
(
)
[dateFormat:protected] =>
[casts:protected] => Array
(
)
[touches:protected] => Array
(
)
[observables:protected] => Array
(
)
[with:protected] => Array
(
)
[morphClass:protected] =>
[exists] => 1
[wasRecentlyCreated] =>
)
私はcreated_at
日付にアクセスしようとすると、私は次のエラーを取得:
ErrorException in Model.php line 2983: preg_match() expects parameter 2 to be string, array given