mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
fixes #2
This commit is contained in:
@@ -44,10 +44,13 @@ class LanguageController extends Controller
|
|||||||
})
|
})
|
||||||
->toArray();
|
->toArray();
|
||||||
foreach ($array as $key => $item) {
|
foreach ($array as $key => $item) {
|
||||||
|
$translated = $item['translatedCount'] > 0 ? $item['translatedCount'] : 1;
|
||||||
|
$itemToTranslate = $item['toTranslate'] > 0 ? $item['toTranslate'] : 1;
|
||||||
|
|
||||||
$array[$key]['name'] = empty($item['name']) ? $item['language'] : $item['name'];
|
$array[$key]['name'] = empty($item['name']) ? $item['language'] : $item['name'];
|
||||||
$array[$key]['description'] = $item['language'] === 'en'
|
$array[$key]['description'] = $item['language'] === 'en'
|
||||||
? '100% translated'
|
? '100% translated'
|
||||||
: round($item['translatedCount'] ?? 1 / $item['toTranslate'] * 100).'% translated';
|
: round($translated / $itemToTranslate * 100).'% translated';
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json($array);
|
return response()->json($array);
|
||||||
|
|||||||
@@ -19,20 +19,17 @@ class HorizonServiceProvider extends HorizonApplicationServiceProvider
|
|||||||
// Horizon::routeMailNotificationsTo('example@example.com');
|
// Horizon::routeMailNotificationsTo('example@example.com');
|
||||||
// Horizon::routeSlackNotificationsTo('slack-webhook-url', '#channel');
|
// Horizon::routeSlackNotificationsTo('slack-webhook-url', '#channel');
|
||||||
|
|
||||||
// Horizon::night();
|
Horizon::night();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register the Horizon gate.
|
* Register the Horizon gate.
|
||||||
*
|
|
||||||
* This gate determines who can access Horizon in non-local environments.
|
* This gate determines who can access Horizon in non-local environments.
|
||||||
*/
|
*/
|
||||||
protected function gate(): void
|
protected function gate(): void
|
||||||
{
|
{
|
||||||
Gate::define('viewHorizon', function ($user) {
|
Gate::define('viewHorizon', function ($user) {
|
||||||
return in_array($user->email, [
|
return $user->hasRole('super-admin');
|
||||||
//
|
|
||||||
]);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user