2
I’m using the barryvdh/Laravel-elfinder. This generates the configuration file /config/elfinder.php.
Inside this file, I inform the path to upload Elfinder files.
I need each user to have their uploads folder. I thought of creating a variable $dir
according to logged in user id but cannot use class Auth
inside the archive /config/elfinder.php
.
There is way to get the user logged in otherwise?
The file is like this:
<?php
$dir = 'arquivos';
return array('dir' => [$dir] );
I want something like that:
<php
$dir = 'arquivos/'.Auth::id();
return array('dir' => [$dir] );
I’ve tried it like this:
<?php
use Auth;
$id=Auth::id();
$dir = 'arquivos/'.$id;
return array('dir' => [$dir] );
And returns this error:
Warning: The use statement with non-compound name 'Auth' has no effect in /var/www/html/dna/config/elfinder.php on line 3 Fatal error: Class 'Auth' not found in /var/www/html/dna/config/elfinder.php on line 5
Can’t put it at the top of the page
use Auth;
– Miguel
It doesn’t work, I’ve tried
– Amanda Lima
It will really suck. This class probably hasn’t even gone into the alias processing that Laravel does internally. It’s probably the order the script is running internally.
– Wallace Maxters
See if it works session. By logging in, you put the ID in the session and take the elfinder.php file..
– Diego Souza
@Gumball’s not gonna work either. There is a much more serious problem than that in Laravel 5. Middleware and autoload affect uploading data from Auth as well.
– Wallace Maxters
When it comes to the files in the folder
config
it is true. It is necessary to have another way out.– Diego Souza