mirror of
https://github.com/flarum/framework.git
synced 2024-11-24 18:41:10 +08:00
Implement helper for generating routes in API actions.
This commit is contained in:
parent
9526dbf210
commit
76114f2979
|
@ -46,6 +46,14 @@ abstract class JsonApiAction implements ActionInterface
|
|||
return new Response($data, $status);
|
||||
}
|
||||
|
||||
protected function route($name, array $parameters = [])
|
||||
{
|
||||
/** @var \Flarum\Http\UrlGeneratorInterface $generator */
|
||||
$generator = app('Flarum\Http\UrlGeneratorInterface');
|
||||
|
||||
return $generator->toRoute($name, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an API request and return an API response.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue
Block a user