mardi 23 octobre 2018

Laravel response download not working inside Route middleware and prefix

Route::group(['middleware' => ['role:0','auth']],function(){
    Route::prefix('s')->group(function () {
        Route::name('s.')->group(function () 
   {Route::get('order/po/download/{item}', function($item = ''){
    return response()->download(storage_path('app/public'.$item));
 });

The routing URL will be like:

s/order/po/download/$item

The issue is everytime I access this url it will bounce to login page for no reason.

Can any help with this? It works in my local vagrant. However, when I push the project onto a live server, it always redirect to login even I have already logged in.

If I put it outside which is accessible for everyone before the Middleware Route (not the best solution but it works):

Route::get('order/po/download/{item}', function($item = ''){
    return response()->download(storage_path('app/public'.$item));
 });



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire