mirror of
https://github.com/flarum/framework.git
synced 2025-02-21 13:59:27 +08:00
fix: allow prefixing route names
This commit is contained in:
parent
38585cf478
commit
3af78c1a3d
@ -207,6 +207,10 @@ class ApiServiceProvider extends AbstractServiceProvider
|
||||
$path = rtrim("/$type$endpoint->path", '/');
|
||||
$name = "$type.$endpoint->name";
|
||||
|
||||
if ($prefix = $resource->routeNamePrefix()) {
|
||||
$name = "$prefix.$name";
|
||||
}
|
||||
|
||||
$routes->addRoute($method, $path, $name, $factory->toApiResource($resource::class, $endpoint->name));
|
||||
}
|
||||
}
|
||||
|
@ -31,4 +31,9 @@ abstract class AbstractResource extends BaseResource
|
||||
{
|
||||
return $context->extractIdFromPath($context);
|
||||
}
|
||||
|
||||
public function routeNamePrefix(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user