1. Go to this page and download the library: Download idkwhoami/flux-files 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/ */
idkwhoami / flux-files example snippets
return [
/*
|--------------------------------------------------------------------------
| Default Storage Disk
|--------------------------------------------------------------------------
|
| The default disk to use for file storage.
|
*/
'disk' => env('FLUX_FILES_DISK', 'local'),
/*
|--------------------------------------------------------------------------
| File Validation
|--------------------------------------------------------------------------
|
| Configure file upload restrictions and validation rules.
|
*/
'validation' => [
'max_file_size' => env('FLUX_FILES_MAX_SIZE', 10240), // KB
'allowed_extensions' => [
'images' => ['jpg', 'jpeg', 'png', 'gif', 'webp', 'svg'],
'documents' => ['pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx'],
'archives' => ['zip', 'rar', '7z', 'tar', 'gz'],
'audio' => ['mp3', 'wav', 'ogg', 'flac'],
'video' => ['mp4', 'avi', 'mov', 'wmv', 'flv'],
],
'mime_types' => [
// Auto-generated based on extensions
],
],
/*
|--------------------------------------------------------------------------
| Eloquent Configuration
|--------------------------------------------------------------------------
|
| Configure the ID type for models (bigint, uuid, ulid).
|
*/
'eloquent' => [
'id_type' => env('FLUX_FILES_ID_TYPE', 'bigint'),
],
/*
|--------------------------------------------------------------------------
| Multi-tenancy
|--------------------------------------------------------------------------
|
| Enable multi-tenant support for file isolation.
|
*/
'multi_tenant' => [
'enabled' => env('FLUX_FILES_MULTI_TENANT', false),
'tenant_model' => null, // Your tenant model class
'tenant_key' => 'tenant_id',
],
];
// Get files for current tenant
$files = File::byTenant(auth()->user()->tenant_id)->get();
// Get folders for current tenant
$folders = Folder::byTenant(auth()->user()->tenant_id)->get();
// In your service provider
use Idkwhoami\FluxFiles\Services\FileValidationService;
FileValidationService::addCustomType('custom', [
'extensions' => ['custom', 'ext'],
'mime_types' => ['application/custom'],
'max_size' => 5120, // KB
]);
use Idkwhoami\FluxFiles\Events\FileUploaded;
use Idkwhoami\FluxFiles\Events\FileDeleted;
// In your EventServiceProvider
protected $listen = [
FileUploaded::class => [
// Your listeners
],
FileDeleted::class => [
// Your listeners
],
];