From 4b4ff1e7fdc8e9e8bd395b40a3d2c54b5e97b722 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Tue, 16 Jun 2015 17:39:47 +0930 Subject: [PATCH] Add API to add a link to an action --- src/Extend/ApiLink.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/Extend/ApiLink.php diff --git a/src/Extend/ApiLink.php b/src/Extend/ApiLink.php new file mode 100644 index 000000000..6450ad58e --- /dev/null +++ b/src/Extend/ApiLink.php @@ -0,0 +1,28 @@ +actions = $actions; + $this->relationships = $relationships; + } + + public function extend(Application $app) + { + foreach ((array) $this->actions as $action) { + $parts = explode('.', $action); + $class = 'Flarum\Api\Actions\\'.ucfirst($parts[0]).'\\'.ucfirst($parts[1]).'Action'; + + foreach ((array) $this->relationships as $relationship) { + $class::$link[] = $relationship; + } + } + } +}