Protect laravel routes with amember

405 Views Asked by At

I am using laravel for my web application. I have integrated amember within my larvel site inside /publi/amember. Now i want to protect my routes using amember. Anyone knows how to do it. I am using L5 Moduler structure for my larvel site.

1

There are 1 best solutions below

0
Andrey Yerokhin On BEST ANSWER

The best approach is use Am_Lite API to do it. http://www.amember.com/docs/API/Lite

So you need to include this file amember/library/Am/Lite.php within your application (before any output done) and then use the following call to check access:

Am_Lite::getInstance()->checkAccess(Am_Lite::PAID);

In event of user has necessary access then this call do nothing otherwise redirect user to login form.