PHP code example of jodeveloper / secure-share

1. Go to this page and download the library: Download jodeveloper/secure-share 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/ */

    

jodeveloper / secure-share example snippets


use Jodeveloper\SecureShare\SecureSharePlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...your existing configuration
        ->plugin(SecureSharePlugin::make());
}

use App\Models\Template;
use Filament\Facades\Filament;
use Filament\Forms\Components\Select;
use Jodeveloper\SecureShare\Filament\Actions\SecureShareAction;
use Jodeveloper\SecureShare\Filament\Schemas\SecureShareForm;

SecureShareAction::make()
    // Define TemplatePolicy::share() to enforce record visibility and sharing rights.
    ->authorize(fn (Template $record): bool => Filament::auth()->user()?->can('share', $record) ?? false)
    ->attachments(fn (array $data, Template $record): array => [[
        'disk' => config('filament.default_filesystem_disk'),
        'path' => $record->templateFiles()->findOrFail($data['version_id'])->file_path,
        'name' => 'template.docx',
        'mime' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
    ]]);

->schema([
    Select::make('version_id')->tent: false),
])
bash
composer  vendor:publish --tag="secure-share-config"
php artisan vendor:publish --tag="secure-share-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="secure-share-views"
php artisan vendor:publish --tag="secure-share-translations"