Skip to content

Commit

Permalink
Add CanAllowHtml and CanModifyState
Browse files Browse the repository at this point in the history
Add CanAllowHtml and CanModifyState to ActivityDate to be able to add for example $date->diffForHumans() bellow date like "2 days ago"
  • Loading branch information
Puralogica committed Feb 28, 2024
1 parent 07addb7 commit 5ff4ea5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion resources/views/infolists/components/activity-date.blade.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<span class="flex-shrink-0 text-xs font-medium text-gray-500 uppercase fi-timeline-item-date dark:text-gray-400">
{{ $getState() != null ? $getDate($getState()) : $getPlaceholder() }}
@if ($isHtmlAllowed())
{!! $getModifiedState() ?? (!is_array($getState()) ? $getState() ?? $getPlaceholder() : null) !!}
@else
{{ $getModifiedState() ?? (!is_array($getState()) ? $getState() ?? $getPlaceholder() : null) }}
@endif
</span>
6 changes: 5 additions & 1 deletion src/Components/ActivityDate.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

namespace JaOcero\ActivityTimeline\Components;

use Filament\Infolists\Components\Entry;
use Illuminate\Support\Carbon;
use Filament\Infolists\Components\Entry;
use Filament\Forms\Components\Concerns\CanAllowHtml;
use JaOcero\ActivityTimeline\Concerns\CanModifyState;

class ActivityDate extends Entry
{
use CanAllowHtml, CanModifyState;

protected string $viewIdentifier = 'activityDate';

protected string $view = 'activity-timeline::infolists.components.activity-date';
Expand Down

0 comments on commit 5ff4ea5

Please sign in to comment.