メタデータの更新時に多重登録されないようにした
This commit is contained in:
parent
810eea2a59
commit
cd26ef6236
@ -28,8 +28,7 @@ Route::get('/checkin/card', function (Request $request, MetadataResolver $resolv
|
|||||||
$metadata = App\Metadata::find($url);
|
$metadata = App\Metadata::find($url);
|
||||||
if ($metadata == null || ($metadata->expires_at !== null && $metadata->expires_at < now())) {
|
if ($metadata == null || ($metadata->expires_at !== null && $metadata->expires_at < now())) {
|
||||||
$resolved = $resolver->resolve($url);
|
$resolved = $resolver->resolve($url);
|
||||||
$metadata = App\Metadata::create([
|
$metadata = App\Metadata::updateOrCreate(['url' => $url], [
|
||||||
'url' => $url,
|
|
||||||
'title' => $resolved->title,
|
'title' => $resolved->title,
|
||||||
'description' => $resolved->description,
|
'description' => $resolved->description,
|
||||||
'image' => $resolved->image,
|
'image' => $resolved->image,
|
||||||
|
Loading…
Reference in New Issue
Block a user