summaryrefslogtreecommitdiff
path: root/src/Concerns/CreatesRoutes.php
blob: 6a8f65b194978784c62f02e17359a46419689b82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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);
    }
}