laravel-files/config/files.php

136 lines
4.1 KiB
PHP
Raw Normal View History

2026-04-14 08:20:55 +00:00
<?php
return [
2026-05-19 12:20:20 +00:00
/*
|--------------------------------------------------------------------------
| Auto-load migrations
|--------------------------------------------------------------------------
|
| When true (the default) the package auto-loads its migrations from
| `vendor/blax-software/laravel-files/database/migrations` so a fresh
| `composer require` + `php artisan migrate` Just Works™. Set to false
| if you publish the migrations and want to manage them yourself the
| package will then defer entirely to your published copies.
|
| See: laravel-workkit/PRINCIPLES/laravel-composer-packages.md
|
*/
'run_migrations' => true,
2026-04-14 08:20:55 +00:00
/*
|--------------------------------------------------------------------------
| Models
|--------------------------------------------------------------------------
|
| Override these to use your own model classes.
|
*/
'models' => [
'file' => \Blax\Files\Models\File::class,
'filable' => \Blax\Files\Models\Filable::class,
],
/*
|--------------------------------------------------------------------------
| Table Names
|--------------------------------------------------------------------------
*/
'table_names' => [
'files' => 'files',
'filables' => 'filables',
],
/*
|--------------------------------------------------------------------------
| Default Disk
|--------------------------------------------------------------------------
|
| The filesystem disk used for storing files. Any disk configured in
| config/filesystems.php is supported (local, s3, gcs, ).
|
*/
'disk' => env('FILES_DISK', 'local'),
/*
|--------------------------------------------------------------------------
| Storage Path Template
|--------------------------------------------------------------------------
|
| The relative path template for new uploads. Placeholders:
| {user_id} authenticated user ID or "anonymous"
| {uuid} generated UUID of the file
| {date} Y/m/d subdirectory
|
*/
'storage_path' => 'files/{date}/{uuid}',
/*
|--------------------------------------------------------------------------
| Warehouse Route
|--------------------------------------------------------------------------
|
| These settings control the public warehouse route that serves files.
|
*/
'warehouse' => [
'enabled' => true,
'prefix' => 'warehouse',
'middleware' => ['web'],
],
/*
|--------------------------------------------------------------------------
| Upload Settings
|--------------------------------------------------------------------------
*/
'upload' => [
'max_size' => 50 * 1024, // KB (50 MB)
'chunk_size' => 1024, // KB per chunk (1 MB)
'allowed_mimes' => [], // empty = allow all
'route_prefix' => 'api/files',
'middleware' => ['api', 'auth:sanctum'],
],
/*
|--------------------------------------------------------------------------
| Image Optimization
|--------------------------------------------------------------------------
|
| Requires spatie/image ^3.8. Optimization is skipped if not installed.
|
*/
'optimization' => [
'enabled' => true,
'default_quality' => 85,
'webp_conversion' => true,
'round_dimensions' => true,
'round_to' => 50,
'skip_formats' => ['gif', 'svg', 'svg+xml'],
'preferred_extensions' => ['svg', 'webp', 'png', 'jpg', 'jpeg'],
],
/*
|--------------------------------------------------------------------------
| Access Control
|--------------------------------------------------------------------------
|
| When laravel-roles is installed, files can be protected via access
| checks. Set 'enabled' to false to serve all files publicly.
|
*/
'access_control' => [
'enabled' => false,
],
];