laravel-filemanager: Class Unisharp\Laravelfilemanager\controllers\LfmController does not exist
- Laravel version :5.6
- Package version :1.8
i did everything said inside installation. but when i try to load file manager give me below error:
ReflectionException
Class Unisharp\Laravelfilemanager\controllers\LfmController does not exist
inside web route i added below route:
Route::get('/laravel-filemanager', '\Unisharp\Laravelfilemanager\controllers\LfmController@show'); Route::post('/laravel-filemanager/upload', '\Unisharp\Laravelfilemanager\controllers\UploadController@upload');even when i put below code inside my routes :Route::group(['prefix' => 'laravel-filemanager', 'middleware' => ['web', 'auth']], function () { \UniSharp\LaravelFilemanager\Lfm::routes(); });give me this error: Class ‘UniSharp\LaravelFilemanager\Lfm’ not found
I really appreciated if someone help me to fix this.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 22 (1 by maintainers)
Commits related to this issue
- create static routes() function in Lfm.php, and update document — committed to UniSharp/laravel-filemanager by streamtw 6 years ago
So we had some debugging afventures as well 😃
The namespace casing has been changed, which has 2 subtle casing changes which are easy to overlook:
has become
note the
SandFFirst of all, backup your own config/lfm.php before upgrading. In the run commands: :
composer update unisharp/laravel-filemanagerphp artisan vendor:publish --tag=lfm_view --forcephp artisan vendor:publish --tag=lfm_public --forcephp artisan vendor:publish --tag=lfm_config --forcephp artisan route:clearphp artisan config:clearthen you have to change “Unisharp\Laravelfilemanager” to “UniSharp\LaravelFilemanager” in all of your codes :
Before : routes/web.php
Route::get('/laravel-filemanager', '\Unisharp\Laravelfilemanager\controllers\LfmController@show');Route::post('/laravel-filemanager/upload', '\Unisharp\Laravelfilemanager\controllers\UploadController@upload');config/app.php :
Unisharp\Laravelfilemanager\LaravelFilemanagerServiceProvider::class,After : routes/web.php
Route::get('/laravel-filemanager', '\UniSharp\LaravelFilemanager\Controllers\LfmController@show');Route::post('/laravel-filemanager/upload', '\UniSharp\LaravelFilemanager\Controllers\UploadController@upload');config/app.php :
UniSharp\LaravelFilemanager\LaravelFilemanagerServiceProvider::class,All the routes in route:list after installation, don’t do step 3 and all will be ok ) Do not add the route group
Route::group([‘prefix’ => ‘laravel-filemanager’, ‘middleware’ => [‘web’, ‘auth’]], function () { \UniSharp\LaravelFilemanager\Lfm::routes(); });
In the /routes/web
@axyr thank you for your help, but I am still getting an error. In ny case
Class 'UniSharp\LaravelFilemanager\Lfm' not foundClass 'Unisharp\Laravelfilemanager\Lfm' not foundFor anyone encounters this error after running
composer update:We have changed namespace from
UnisharptoUniSharp, and change the first character of every namespace into capital.If you are updating this package and encounter any errors like
Class not found, please remove this package entirely and reinstall again.@Tehnik762,@farbodkain
php artisan vendor:publish --tag=lfm_view --forceAfer update…
Change: Unisharp\Laravelfilemanager\LaravelFilemanagerServiceProvider::class,
To: "Notice: Uni S arp " and Laravel F ilemanager are capitilize now… UniSharp\LaravelFilemanager\LaravelFilemanagerServiceProvider::class,
in your routes : Route::get(‘/laravel-filemanager’, ‘\Unisharp\Laravelfilemanager\controllers\LfmController@show’);
change ‘controllers’ to ‘Controllers’. same for your post route.
in vendor\unisharp\laravel-filemanager\src\Controllers the folder is now written with a capital C, where before it was ‘controllers’
Hope this helps, Vincent van Wijk
The problem is due to missing files. When Composer downloads the files, lfm.php and other files are missing, so you get the Class Unisharp\Laravelfilemanager\controllers\LfmController does not exist. So you can fix that forcing Composer to download a specific version having all package files, so modify your composer.json file. Find:
"unisharp/laravel-filemanager": "~1.8"And change this line to:
"unisharp/laravel-filemanager": "1.9.0"And then run:
composer updateNow Composer downloads all package files and your package runs correctly. I looked into repository and I found that inside version tags (1.9.1 and 1.9.2) these files are already missing. Maybe project developers need to add this files inside the repositories.Note: if you try to update to 1.9.2 after you have installed 1.9.0, you get the same problem, Composer updates your local files as the same in the repository.
I tried all things at this topic but I didnt solve Class Unisharp\Laravelfilemanager\controllers\LfmController does not exist problem I use laravel 5.6