expires_atに有効な値が設定されている場合のみ、メタデータの有効期限判定を行う

This commit is contained in:
shibafu 2019-01-15 23:58:14 +09:00
parent 5f01cc3430
commit acb9b5821d

View File

@ -26,7 +26,7 @@ Route::get('/checkin/card', function (Request $request, MetadataResolver $resolv
$url = $formatter->normalizeUrl($request->input('url')); $url = $formatter->normalizeUrl($request->input('url'));
$metadata = App\Metadata::find($url); $metadata = App\Metadata::find($url);
if ($metadata == null || new DateTime($metadata->expires_at) < new DateTime("now")) { if ($metadata == null || ($metadata->expires_at !== null && new DateTime($metadata->expires_at) < new DateTime("now"))) {
$resolved = $resolver->resolve($url); $resolved = $resolver->resolve($url);
$metadata = App\Metadata::create([ $metadata = App\Metadata::create([
'url' => $url, 'url' => $url,