Uploaded image for project: 'PHP ORMs'
  1. PHP ORMs
  2. PHPORM-250

laravel-mongodb - Issue #3163: [Feature Request] $user->getChanges(), date transformation not being applied

    • Type: Icon: Question Question
    • Resolution: Works as Designed
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: Laravel
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      masterbater has created Issue #3163: [Feature Request] $user->getChanges(), date transformation not being applied in laravel-mongodb. This Jira ticket was filed by GromNaN

      Issue Text:
      ```php
      $validatedData = $request->validated();
      $update = $user->update($validatedData);

      return response()->json(['message' => 'success', 'data' => $user->getChanges()], Response::HTTP_OK);
      ```

      This returns

      {"message":"success","data":{"fname":"fname","updatedAt":{"$date":{"$numberLong":"1727594198505"}}}}

      I didnt test with default timestamp fields since I have custom fields, but the transformation should work especially with eloquent. Let me
      const CREATED_AT = 'createdAt';
      const UPDATED_AT = 'updatedAt';

            Assignee:
            jerome.tamarelle@mongodb.com Jérôme Tamarelle
            Reporter:
            dbeng-pm-bot PM Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: