forked from Azuriom/Plugin-Vote
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelpers.php
34 lines (30 loc) · 990 Bytes
/
helpers.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
use Azuriom\Plugin\Vote\Models\Vote;
use Illuminate\Support\Facades\Cache;
/*
|--------------------------------------------------------------------------
| Helper functions
|--------------------------------------------------------------------------
|
| Here is where you can register helpers for your plugin. These
| functions are loaded by Composer and are globally available on the app !
| Just make sure you verify that a function doesn't exist before registering it
| to prevent any side effect.
|
*/
if (! function_exists('display_rewards')) {
function display_rewards()
{
return setting('vote.display-rewards', true);
}
}
if (! function_exists('vote_leaderboard')) {
function vote_leaderboard()
{
return Cache::remember('vote.leaderboard', now()->addMinutes(5), function () {
return Vote::getTopVoters(now()->startOfMonth())->map(function ($value) {
return (object) $value;
});
});
}
}