Closed gerbenjacobs closed 6 years ago
I'd prefer not to add another attribute like that because it's tied so closely with authorisation. The only reason the private
one exists is because limiting visibility for unauthenticated users isn't possible with policies.
Just update the Category::createThreads
policy method to check the category ID, or if you need it to be dynamic, create a migration of your own to add a column.
The use case is for something like an 'announcement category'. A place where only admins/moderators can post new threads, but anyone can reply.
As far as I can see the only policy for thread creation is
can('createThreads')
. I thought I could change a category to 'private' so that only I can post threads, but this actually hides it from regular users.Would it be an idea to add a boolean to
categories
named something likeprotected
? (If so, I can create a pull request for this)