Initial Version
This commit is contained in:
15
shared/lib/Routing/Attributes/AnonymousRoute.php
Normal file
15
shared/lib/Routing/Attributes/AnonymousRoute.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace KTXF\Routing\Attributes;
|
||||
|
||||
use Attribute;
|
||||
|
||||
#[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_CLASS)]
|
||||
class AnonymousRoute
|
||||
{
|
||||
public function __construct(
|
||||
public readonly string $path,
|
||||
public readonly string $name,
|
||||
public readonly array $methods = ['GET'],
|
||||
) {}
|
||||
}
|
||||
26
shared/lib/Routing/Attributes/AuthenticatedRoute.php
Normal file
26
shared/lib/Routing/Attributes/AuthenticatedRoute.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace KTXF\Routing\Attributes;
|
||||
|
||||
use Attribute;
|
||||
|
||||
#[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_CLASS)]
|
||||
class AuthenticatedRoute
|
||||
{
|
||||
/**
|
||||
* @param string $path Route path
|
||||
* @param string $name Route name
|
||||
* @param array $methods HTTP methods
|
||||
* @param array $permissions Required permissions (OR logic - user needs ANY)
|
||||
* Examples:
|
||||
* - ['user.profile.edit'] - exact permission
|
||||
* - ['user_manager.users.*'] - wildcard permission
|
||||
* - ['user.edit.own', 'user.edit.any'] - multiple options
|
||||
*/
|
||||
public function __construct(
|
||||
public readonly string $path,
|
||||
public readonly string $name,
|
||||
public readonly array $methods = ['GET'],
|
||||
public readonly array $permissions = [],
|
||||
) {}
|
||||
}
|
||||
Reference in New Issue
Block a user