I am using Laravel, and I have created a PreventBack middleware to prevent users from returning to the page after logout.
Middleware
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
class PreventBack
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$response = $next($request);
return $response->header('Cache-Control', 'no-cache, no-store,
max-age=0, must-revalidate')
->header('Pragma', 'no-cache')
->header('Expires', 'Sun, 02 Jan 1990 00:00:00 GMT');
}
}
But I have a route that returns the profile image.
Route::get('/profileimage', function () {
return response()->file(storage_path('profile_image.jpg'));
});
When I put my profile image route in preventing back middleware, this route stops working, and the route does not return the profile image.
Route::group(['middleware' => ['PreventBack']], function () {
Route::get('/profileimage', function () {
return response()->file(storage_path('profile_image.jpg'));
});
});
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/BcUDqtz
via IFTTT
Aucun commentaire:
Enregistrer un commentaire