Refactor VisaMasterPaymentOrderInfolist and SpatieMediaLibraryFileEntry components
- Cleaned up imports and improved code formatting for better readability. - Adjusted layout in VisaMasterPaymentOrderInfolist schema for consistent column spans. - Enhanced SpatieMediaLibraryFileEntry component by streamlining property definitions and ensuring consistent formatting.
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
namespace App\Filament\Infolists\Components;
|
||||
|
||||
use Closure;
|
||||
use Filament\Infolists\Components\Entry;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Infolists\Components\Entry;
|
||||
use Filament\Support\Concerns\HasMediaFilter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Arr;
|
||||
@@ -19,7 +19,7 @@ class SpatieMediaLibraryFileEntry extends Entry
|
||||
|
||||
public function getViewMediaActionName(): string
|
||||
{
|
||||
return 'view_media_' . $this->getName();
|
||||
return 'view_media_'.$this->getName();
|
||||
}
|
||||
|
||||
protected function setUp(): void
|
||||
@@ -38,45 +38,45 @@ class SpatieMediaLibraryFileEntry extends Entry
|
||||
|
||||
protected string $view = 'filament.infolists.components.spatie-media-library-file-entry';
|
||||
|
||||
protected string | Closure | null $collection = null;
|
||||
protected string|Closure|null $collection = null;
|
||||
|
||||
protected string | Closure | null $conversion = null;
|
||||
protected string|Closure|null $conversion = null;
|
||||
|
||||
protected string | Closure $visibility = 'private';
|
||||
protected string|Closure $visibility = 'private';
|
||||
|
||||
protected bool | Closure $isDownloadable = true;
|
||||
|
||||
protected bool | Closure $isPreviewable = true;
|
||||
protected bool|Closure $isDownloadable = true;
|
||||
|
||||
public function collection(string | Closure | null $collection): static
|
||||
protected bool|Closure $isPreviewable = true;
|
||||
|
||||
public function collection(string|Closure|null $collection): static
|
||||
{
|
||||
$this->collection = $collection;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function conversion(string | Closure | null $conversion): static
|
||||
public function conversion(string|Closure|null $conversion): static
|
||||
{
|
||||
$this->conversion = $conversion;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function visibility(string | Closure $visibility): static
|
||||
public function visibility(string|Closure $visibility): static
|
||||
{
|
||||
$this->visibility = $visibility;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function downloadable(bool | Closure $condition = true): static
|
||||
|
||||
public function downloadable(bool|Closure $condition = true): static
|
||||
{
|
||||
$this->isDownloadable = $condition;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function previewable(bool | Closure $condition = true): static
|
||||
|
||||
public function previewable(bool|Closure $condition = true): static
|
||||
{
|
||||
$this->isPreviewable = $condition;
|
||||
|
||||
@@ -97,12 +97,12 @@ class SpatieMediaLibraryFileEntry extends Entry
|
||||
{
|
||||
return (string) $this->evaluate($this->visibility);
|
||||
}
|
||||
|
||||
|
||||
public function isDownloadable(): bool
|
||||
{
|
||||
return (bool) $this->evaluate($this->isDownloadable);
|
||||
}
|
||||
|
||||
|
||||
public function isPreviewable(): bool
|
||||
{
|
||||
return (bool) $this->evaluate($this->isPreviewable);
|
||||
@@ -137,7 +137,7 @@ class SpatieMediaLibraryFileEntry extends Entry
|
||||
}
|
||||
|
||||
$records = Arr::wrap($record);
|
||||
|
||||
|
||||
$allMedia = collect([]);
|
||||
|
||||
$collection = $this->getCollection() ?? 'default';
|
||||
@@ -145,7 +145,7 @@ class SpatieMediaLibraryFileEntry extends Entry
|
||||
foreach ($records as $record) {
|
||||
/** @var Model $record */
|
||||
$media = $record->getRelationValue('media');
|
||||
|
||||
|
||||
if (! $media) {
|
||||
continue;
|
||||
}
|
||||
@@ -160,7 +160,7 @@ class SpatieMediaLibraryFileEntry extends Entry
|
||||
fn (Collection $media) => $this->filterMedia($media)
|
||||
)
|
||||
->sortBy('order_column');
|
||||
|
||||
|
||||
$allMedia = $allMedia->merge($filteredMedia);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user