php - laravel prevent unauthenticated users from viewing the files -
i want try make route filter using pattern filter, it's doesn't work. how make route prevent unauthenticated users viewing files on specific folder ?
try this:
route::get('/directory/{file}', array('before' => 'auth', function($file) { return public_path() . "/directory/$file"; }));
change directory
whatever directory trying protect. also, assumed files want deal out in public directory. may need changed too, depending on usage.
auth
filter created in default install of laravel. makes sure aren't "guest." let people access directory if "logged in." believe looks cookie laravel sets when log in.
Comments
Post a Comment