Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

SGUserFace's avatar

request->authorize and gate

What is difference between request->authorize and gate?

0 likes
1 reply
jlrdw's avatar

Gate is the definition of: can a user as example edit a certain record.

The request->authorize is a controller call (calling the gate guard) seeing if the current user is allowed.

request->authorize: Is mainly calling the policies and gates and checking is it ok for this user to edit, as example, yes user is a bookkeeper and can edit a transaction.

Or

No, this is just the janitor logged it, he or she cannot edit the General Ledger.

gate is a specific definition that is checked, okay you are logged in, fine, but are you allowed here. Meaning a certain page or area.

It all boils down to role the user has.

I'd strongly suggest working the examples and download any github example Jeffrey has on this. It is a little tricky, and requires practice. This is not a one evening lesson, could take days or weeks.

Please or to participate in this conversation.