Metadata.expires_atをCarbon化
This commit is contained in:
parent
acb9b5821d
commit
810eea2a59
@ -12,4 +12,6 @@ class Metadata extends Model
|
||||
|
||||
protected $fillable = ['url', 'title', 'description', 'image', 'expires_at'];
|
||||
protected $visible = ['url', 'title', 'description', 'image', 'expires_at'];
|
||||
|
||||
protected $dates = ['created_at', 'updated_at', 'expires_at'];
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ Route::get('/checkin/card', function (Request $request, MetadataResolver $resolv
|
||||
$url = $formatter->normalizeUrl($request->input('url'));
|
||||
|
||||
$metadata = App\Metadata::find($url);
|
||||
if ($metadata == null || ($metadata->expires_at !== null && new DateTime($metadata->expires_at) < new DateTime("now"))) {
|
||||
if ($metadata == null || ($metadata->expires_at !== null && $metadata->expires_at < now())) {
|
||||
$resolved = $resolver->resolve($url);
|
||||
$metadata = App\Metadata::create([
|
||||
'url' => $url,
|
||||
|
Loading…
Reference in New Issue
Block a user