PHP code example of gheith3 / filament-file-view-entry
1. Go to this page and download the library: Download gheith3/filament-file-view-entry library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
gheith3 / filament-file-view-entry example snippets
use gheith3\FileViewEntryPlugin\FileViewEntryPlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugin(FileViewEntryPlugin::make());
}
use gheith3\FileViewEntryPlugin\Infolists\Components\FileViewEntry;
// Single file - opens in modal when clicked
FileViewEntry::make('file_path')
->downloadable();
// Multiple files in grid layout
FileViewEntry::make('attachments')
->grid(4)
->downloadable();
// In your resource
public static function infolist(Infolist $infolist): Infolist
{
return $infolist
->schema([
FileViewEntry::make('uploadedFiles') // relationship name
->label('Attachments')
->grid(6)
->downloadable(),
]);
}