67 lines
2.0 KiB
Plaintext
67 lines
2.0 KiB
Plaintext
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Models\Document;
|
|
use App\Models\Folder;
|
|
use App\Models\Project;
|
|
use App\Models\User;
|
|
use App\Policies\DocumentPolicy;
|
|
use App\Policies\FolderPolicy;
|
|
use App\Policies\PermissionPolicy;
|
|
use App\Policies\ProfilePolicy;
|
|
use App\Policies\ProjectPolicy;
|
|
use App\Policies\RolePolicy;
|
|
use App\Policies\UserPolicy;
|
|
use Illuminate\Support\Facades\Blade;
|
|
use Illuminate\Support\Facades\Validator;
|
|
use Illuminate\Support\ServiceProvider;
|
|
use Livewire\Livewire;
|
|
use Spatie\Permission\Models\Permission;
|
|
use Spatie\Permission\Models\Role;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
|
|
protected $policies = [
|
|
User::class => UserPolicy::class,
|
|
User::class => ProfilePolicy::class,
|
|
Role::class => RolePolicy::class,
|
|
Permission::class => PermissionPolicy::class,
|
|
Document::class => DocumentPolicy::class,
|
|
Project::class => ProjectPolicy::class,
|
|
Folder::class => FolderPolicy::class,
|
|
];
|
|
|
|
/**
|
|
* Register any application services.
|
|
*/
|
|
public function register(): void
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
//
|
|
Blade::componentNamespace('App\\View\\Components', 'icons');
|
|
Blade::component('multiselect', \App\View\Components\Multiselect::class);
|
|
|
|
Livewire::component('project-show', \App\Http\Livewire\ProjectShow::class);
|
|
Livewire::component('project-show', \App\Http\Livewire\FileUpload::class);
|
|
Livewire::component('toolbar', \App\Http\Livewire\Toolbar::class);
|
|
|
|
Validator::extend('max_upload_size', function ($attribute, $value, $parameters, $validator) {
|
|
$maxSize = env('MAX_UPLOAD_SIZE', 51200); // Default 50MB
|
|
$totalSize = array_reduce($value, function($sum, $file) {
|
|
return $sum + $file->getSize();
|
|
}, 0);
|
|
|
|
return $totalSize <= ($maxSize * 1024);
|
|
});
|
|
}
|
|
}
|