How to use laravel file manager by unisharp on shared hosting - laravel

First I will tell you that I have made this on my localhost and works well. But when I use on the production server(shared hosting) it does not work.
when I access my web it shows :
Class 'UniSharp\LaravelFilemanager\Lfm' not found
I put this on my route/web.php :
Route::group(['middleware' => ['auth', 'verified']], function () {
Route::group(['prefix' => 'laravel-filemanager', 'middleware' => ['web']], function () {
\UniSharp\LaravelFilemanager\Lfm::routes();
});
});
I have run all commands from the documentation, and also upload all necessary files that produced by the commands. Thanks in advance

Related

composer-vendor-folder-shows-up-instead-of-vendor-page-on-vendor-routes

I have a vendor routes in my routes folder
Route::group(['prefix' => 'vendor', 'middleware' => ['auth:vendor']], function () {
Route::get('/dashboard', 'Vendor\VendorController#dashboard')->name('vendor.dashboard')-
>middleware('bannedVendor');
Route::get('/logout/{id?}', 'Vendor\LoginController#logout')->name('vendor.logout');
});
And whenever i try accessing any vendor routes on my browser my package(vendor) folder shows up instead.
How can i resolve this issue?

laravel 5.2 make dashboard for admin

I am new in laravel 5.2. I want to make dashboard for admin but i do not understand how to make it. I did copy all controller files in admin folder and also copied view folder in admin folder.
I did try some code which is mention below:-
Route::group(array('namespace'=>'Admin'), function()
{
Route::get('/admin', array('as' => 'admin', 'uses' => 'UserController#index'));
Route::get('/admin/register', array('as' => 'register', 'uses' => 'UserController#register'));
Route::get('/admin/login', array('as' => 'login', 'uses' => 'UserController#login'));
});
but now I want to show all controller files under admin like:-
localhost:8000/admin/users
If you want to use all route of admin on localhost:8000/admin.
You should use route group and add prefix on it, like that
Route::group(['prefix' => 'admin/'], function () {
Route::get('users', function () {
// Matches The "/admin/users" URL
});
Route::get('login', function () {
// Matches The "/admin/login" URL
});
.......
});
Read more at this doc https://laravel.com/docs/5.2/routing#route-groups
I hope this could help you.

Laravel 5.2 redirect doesn't save flash messages

I installed fresh laravel 5.2.29.
My routes.php:
Route::group(['middleware' => ['web']], function () {
Route::get('/a', function () {
return redirect('/b', 302)->with('error', 'error description');
});
Route::get('/b', function () {
return session('error');
});
});
When I go to /a in browser it redirects me to /b, but shows me nothing. What should I do to it show me error description? Or why does not it store flash data?
Basically, if you are running Laravel 5.2.27 and up, do not use the web middleware group. It is applied for you by default as you can see in app/Http/RouteServiceProvider.php:
protected function mapWebRoutes(Router $router)
{
$router->group([
'namespace' => $this->namespace, 'middleware' => 'web',
], function ($router) {
require app_path('Http/routes.php');
});
}
If you try to apply the web middleware again, you'll run into weird problems like what you are currently facing.

Laravel route duplication

I am working on building my first API. Currently, I have the following.
Route::group(['namespace' => 'Api', 'prefix' => 'api'], function () {
Route::get('/', 'AuthController#showLogin');
Route::post('login', 'AuthController#login');
Route::post('register', 'AuthController#register');
Route::group(['middleware' => ['jwt.auth']], function () {
Route::resource('account', 'AccountController');
Route::resource('notifications', 'NotificationController');
Route::resource('contacts', 'ContactController');
});
});
How can I make it that all requests to /api/v1 go to the API?
For future use, when I upgrade/add new features to an API going to /api, it's always the latest version. However, if a user goes to api/v1/, they use only version 1 of the API.

Groups in group on routing

Simple little question :
on Laravel 4, it seems that a group of routes into an another group isn't working.
Is there any solution to make it work ? Or do I have to write my routes in another way ?
Example :
Route::group(array('prefix' => 'app', 'before' => 'auth_api'), function()
{
Route::group(array('prefix' => '{app_id}'), function()
{
Route::get('/', 'AppController#show');
Route::group(array('prefix' => 'achievement'), function()
{
Route::get('/{id}', 'AchievementController#show');
});
});
});
I'm unable to get a route to (example here) app/1234/achievement/1
Maybe it's too complex here. I have not any error, just a blank page (no PHP error)
Laravel 4 isn't offering this possibility but this package : https://github.com/jasonlewis/enhanced-router do the work.

Resources