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

Cushty's avatar
Level 4

Best way to deal with 403 error

Hi, i am using:

public static function canCreate(): bool
    {
        return auth()->user()->application()->count() === 0 || auth()->user()->isAdmin();
    }

and it's working well, but if I manually go to create page I get a 403 Forbidden which I know is what is supposed to happen, but it got me thinking do you guys design a 403 page or do you do a redirect instead? Just wanted to know your thoughts, thanks

0 likes
3 replies
Snapey's avatar

if someone is meesing with urls they should not have access to, I just stick a 403 page in their face. no point in being polite about it

1 like
Cushty's avatar
Level 4

@Snapey :) I think that is a good way to treat them, I may publish the views so I can add a home button or something, thanks

1 like

Please or to participate in this conversation.