Skip to content

Commit

Permalink
Merge pull request #197 from PortableStudios/feature/VG-455_Suggestio…
Browse files Browse the repository at this point in the history
…n_Access

Show who made the entry when it's for logged in users only
  • Loading branch information
jeremy-portable authored Nov 15, 2024
2 parents 681248f + fe5ff7e commit 86b4408
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions resources/views/tables/columns/created_by.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div class="fi-ta-text grid w-full gap-y-1 px-3 py-4">
<div class="flex">
<div class="fi-ta-text-item inline-flex items-center gap-1.5 ">
<span class="fi-ta-text-item-label text-sm leading-6 text-gray-950">
{{ $getRecord()->User?->name }}
</span>
</div>
</div>
</div>
6 changes: 6 additions & 0 deletions src/Filament/Resources/FormEntryResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ public static function getColumns(ModelsForm $form): array
->words(10);
}

if ($form->only_for_logged_in) {
// show user who created it
$columns[] = Tables\Columns\ViewColumn::make('')
->label('Submitted By')
->view('fila-cms::tables.columns.created_by');
}

$columns[] = Tables\Columns\ViewColumn::make('created_at')
->label('Submitted Time')
Expand Down
5 changes: 5 additions & 0 deletions src/Models/FormEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ public function form()
return $this->belongsTo(Form::class);
}

public function user()
{
return $this->belongsTo(config('auth.providers.users.model'));
}

public function displayHtml(): Attribute
{
return new Attribute(function () {
Expand Down

0 comments on commit 86b4408

Please sign in to comment.