diff --git a/app/Services/Hook.php b/app/Services/Hook.php
index a99be142..36754ae8 100644
--- a/app/Services/Hook.php
+++ b/app/Services/Hook.php
@@ -18,7 +18,8 @@ class Hook
* [
* 'title' => 'Title', # will be translated by translator
* 'link' => 'user/config', # route link
- * 'icon' => 'fa-book' # font-awesome icon
+ * 'icon' => 'fa-book', # font-awesome icon
+ * 'new-tab' => false, # open the link in new tab or not, false by default
* ]
* @return void
*/
diff --git a/app/helpers.php b/app/helpers.php
index a3d939be..b6c798dc 100644
--- a/app/helpers.php
+++ b/app/helpers.php
@@ -166,8 +166,9 @@ if (! function_exists('bs_menu')) {
} else {
if ($value) {
$content .= sprintf(
- ' %s',
+ ' %s',
url((string) $value['link']),
+ Arr::get($value, 'new-tab') ? 'target="_blank"' : '',
$value['icon'] == 'fa-circle' ? 'far' : 'fas',
(string) $value['icon'],
trans((string) $value['title'])
diff --git a/tests/ServicesTest/HookTest.php b/tests/ServicesTest/HookTest.php
index 7f7bf0d4..9389b15c 100644
--- a/tests/ServicesTest/HookTest.php
+++ b/tests/ServicesTest/HookTest.php
@@ -16,11 +16,12 @@ class HookTest extends TestCase
'title' => 'Link A',
'link' => '/to/a',
'icon' => 'fa-book',
+ 'new-tab' => true,
]);
$this->actAs('normal')
->get('/user')
->assertSee('Link A')
- ->assertSee('/to/a')
+ ->assertSee('/to/a" target="_blank"')
->assertSee('fa-book');
// Out of bound