-
-
Notifications
You must be signed in to change notification settings - Fork 182
Restrict Access To Path
Muah edited this page Nov 28, 2019
·
9 revisions
let's say you have this structure
root "/"
|_users
|_admin
|_pdfs
|_billings
|_testing
|_clients
|_others
and you want to allow access to only pdfs
, so the params would be
@include('MediaManager::_manager', ['restrict' => [
'path' => 'users/admin/pdfs',
'uploadTypes' => ['image/*', 'application/pdf'], // mime-types
'uploadSize' => 5 // in MB
]])
- all the params are optional, so you can use only what u need.
- the
uploadTypes
param have to be anarray
of items not a string.
- in user model
// ... class User extends Authenticatable { // ... public static function boot() { parent::boot(); $disk = app('filesystem')->disk(config('mediaManager.storage_disk')); static::created(function ($model) use ($disk) { $disk->makeDirectory('users/' . $model->id); }); static::deleted(function ($model) use ($disk) { $disk->deleteDirectory('users/' . $model->id); }); } }
- in user profile edit page Use The Manager From A Modal
<div v-if="inputName"> @include('MediaManager::extras.modal', ['restrict' => [ 'path' => "users/$user->id", 'uploadTypes' => ['image/*'], 'uploadSize' => 2 ]]) </div>
- disable
- global search
- disable
- upload from url