Die Datenbank hat dieses Datum „2025-01-15 14:01:26“
Hier ist der Code, den ich verwende:
Code: Select all
$company = Company::find($user->company_id);
// Accessing created_at directly
$createdAtDirect = $company->created_at;
// Accessing created_at using the value() method
$createdAtValue = $company->value('created_at');
// Debugging output
dd([
'created_at_direct' => $createdAtDirect,
'created_at_value' => $createdAtValue,
]);
Code: Select all
array:2 [▼ // app\Http\Middleware\TrialCheckMiddleware.php:43
"created_at_direct" =>
Illuminate\Support
\
Carbon @1736949686 {#1981 ▼
#endOfTime: false
#startOfTime: false
#constructedObjectId: "00000000000007bd0000000000000000"
#localMonthsOverflow: null
#localYearsOverflow: null
#localStrictModeEnabled: null
#localHumanDiffOptions: null
#localToStringFormat: null
#localSerializer: null
#localMacros: null
#localGenericMacros: null
#localFormatFunction: null
#localTranslator: null
#dumpProperties: array:3 [▶]
#dumpLocale: null
#dumpDateProperties: null
date: 2025-01-15 14:01:26.0 UTC (+00:00)
}
"created_at_value" =>
Illuminate\Support
\
Carbon @1695133599 {#1977 ▼
#endOfTime: false
#startOfTime: false
#constructedObjectId: "00000000000007b90000000000000000"
#localMonthsOverflow: null
#localYearsOverflow: null
#localStrictModeEnabled: null
#localHumanDiffOptions: null
#localToStringFormat: null
#localSerializer: null
#localMacros: null
#localGenericMacros: null
#localFormatFunction: null
#localTranslator: null
#dumpProperties: array:3 [▶]
#dumpLocale: null
#dumpDateProperties: null
date: 2023-09-19 14:26:39.0 UTC (+00:00)
}
]
Code: Select all
date: 2025-01-15 14:01:26.0 UTC (+00:00)
date: 2023-09-19 14:26:39.0 UTC (+00:00)
Was könnte diese Diskrepanz verursachen?< /p>
Zusätzlicher Kontext:
Die Spalte „created_at“ wird durch Laravels Standard-Zeitstempelverhalten verwaltet.
Für das Modell sind keine Mutatoren oder Accessoren definiert erstellt_at.