@php
$tag = data_get($image, 'tag');
$date = data_get($image, 'created_at');
$interval = \Illuminate\Support\Carbon::parse($date);
// Check if tag looks like a commit SHA (hex string) or PR tag (pr-N)
$isCommitSha = preg_match('/^[0-9a-f]{7,128}$/i', $tag);
$isPrTag = preg_match('/^pr-\d+$/', $tag);
$isRollbackable = $isCommitSha || $isPrTag;
@endphp
@if (data_get($image, 'is_current'))
LIVE
|
@endif
@if ($isCommitSha)
SHA: {{ $tag }}
@elseif ($isPrTag)
PR: {{ $tag }}
@else
Tag: {{ $tag }}
@endif
{{ $interval->diffForHumans() }}
{{ $date }}
@can('deploy', $application)
@if (data_get($image, 'is_current'))
Rollback
@elseif (!$isRollbackable)
Rollback
@else
Rollback
@endif
@endcan