I am trying to upgrade my Laravel4 app to Laravel5.
In my Laravel4 app, I use app/config/constants.php
file and difine constants by using Request class.
if (Request::is('admin/*'))
{
define('PATH', 'admin')
}else
{
define('PATH', 'public')
}
and read it in app/start.php
.
require __DIR__.'/../app/config/constants.php';
These constants are used in controllers, models, commands, views, and files in 'app/config' directory.
In Laravel5, how to read this file?
I tried: 1, added it in config
directory and changed composer.json
"autoload": {
"files": [
"config/constants.php"
]
}
I got error: PHP Fatal error: Class 'Request' not found
2, added it in config
directory and changed app/Providers/AppServiceProvider.php
public function boot()
{
require __DIR__.'/../config/constants.php';
}
I got same error: PHP Fatal error: Class 'Request' not found
Thanks,
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire