summaryrefslogtreecommitdiff
path: root/src/Concerns/CreatesRoutes.php
diff options
context:
space:
mode:
authorSam Light <sam@lightscale.co.uk>2026-06-10 19:00:32 +0100
committerSam Light <sam@lightscale.co.uk>2026-06-10 19:00:32 +0100
commit6ad39e3ba64e518bcdba1fc32b6247375be39a8a (patch)
treecc7ba7901043428b327d454580460e7b67c399b9 /src/Concerns/CreatesRoutes.php
parent9e6a18235564df5046c40570a864bcbd5c8bcf62 (diff)
shared code in traits for common features for groups
Diffstat (limited to 'src/Concerns/CreatesRoutes.php')
-rw-r--r--src/Concerns/CreatesRoutes.php41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/Concerns/CreatesRoutes.php b/src/Concerns/CreatesRoutes.php
new file mode 100644
index 0000000..6a8f65b
--- /dev/null
+++ b/src/Concerns/CreatesRoutes.php
@@ -0,0 +1,41 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Lightscale\Router\Concerns;
+
+use Lightscale\Router\Enums\HttpMethod;
+use Lightscale\Router\RouteDefinition;
+
+trait CreatesRoutes
+{
+ public function get(string $path, callable $handler): RouteDefinition
+ {
+ return $this->make(HttpMethod::Get, $path, $handler);
+ }
+
+ public function post(string $path, callable $handler): RouteDefinition
+ {
+ return $this->make(HttpMethod::Post, $path, $handler);
+ }
+
+ public function put(string $path, callable $handler): RouteDefinition
+ {
+ return $this->make(HttpMethod::Put, $path, $handler);
+ }
+
+ public function patch(string $path, callable $handler): RouteDefinition
+ {
+ return $this->make(HttpMethod::Patch, $path, $handler);
+ }
+
+ public function delete(string $path, callable $handler): RouteDefinition
+ {
+ return $this->make(HttpMethod::Delete, $path, $handler);
+ }
+
+ public function any(string $path, callable $handler): RouteDefinition
+ {
+ return $this->make(HttpMethod::Any, $path, $handler);
+ }
+}