-
Notifications
You must be signed in to change notification settings - Fork 554
/
FilesUploaderConfig.php
31 lines (26 loc) · 1.27 KB
/
FilesUploaderConfig.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
namespace A17\Twill\Http\ViewComposers;
use Illuminate\Contracts\View\View;
class FilesUploaderConfig
{
public function compose(View $view)
{
$libraryDisk = config('twill.file_library.disk');
$endpointType = config('twill.file_library.endpoint_type');
$allowedExtensions = config('twill.file_library.allowed_extensions');
$filesUploaderConfig = [
'endpointType' => $endpointType,
'endpoint' => $endpointType === 'local' ? route('admin.file-library.files.store') : s3Endpoint($libraryDisk),
'successEndpoint' => route('admin.file-library.files.store'),
'signatureEndpoint' => route('admin.file-library.sign-s3-upload'),
'endpointBucket' => config('filesystems.disks.' . $libraryDisk . '.bucket', 'none'),
'endpointRegion' => config('filesystems.disks.' . $libraryDisk . '.region', 'none'),
'accessKey' => config('filesystems.disks.' . $libraryDisk . '.key', 'none'),
'csrfToken' => csrf_token(),
'acl' => config('twill.file_library.acl'),
'filesizeLimit' => config('twill.file_library.filesize_limit'),
'allowedExtensions' => $allowedExtensions,
];
$view->with(compact('filesUploaderConfig'));
}
}