jeudi 18 janvier 2018

Laravel file manager Dynamic base_directory

I using unisharp's laravel file manager. it works great and i am in love with the flexibility it has.

However, I need to users to store their files in their respective folders. i am able to do this by changing user_field in conf file. What i am not able to do is give acess to super administrator so that he can see all other user's files! i am almost giving up trying to figure this for days.

here is what i have tried so far:

in config/lfm.php

'base_directory'=>Unisharp\Laravelfilemanager\Handlers\ConfigHandler::class`,

And in the handler:

namespace Unisharp\Laravelfilemanager\Handlers;
class ConfigHandler
{
    public function userField()
    {
        return auth()->user()->name;
    }

    public function baseDirectory(){
        if(auth()->user()->user_type !== "S"){
            return 'storage/'.auth()->user()->name;
        }
        else{
            return 'storage/';
        }
    }
}

But the above code shows a blank page and it creates folders in Abyss which i cant find anywhere on my machine.

Any help will be appriciated.

Thanks in advance.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2mIEPE4
via IFTTT

Aucun commentaire:

Enregistrer un commentaire