8 months ago

How to allow public to view article with permission

Posted 8 months ago by nhayder

In my app i have many to many relationship for my articles these are basically are roles, So the admin can choose which role to attach to article.

currently i have this gate function on the ArticleController

if (Gate::denies('articles.view')) {
            return view('auth.login');;

the gate is doing what is supposed to do? and its working fine so there is no issue with that.

But now i need to add an option that will make the article available to public without registration?

my question is what is the laravel way to achieve this type of permission ????

Any ideas ????

Please sign in or create an account to participate in this conversation.