You've already forked Epicnabbo-Catalogus-Updated-Daily
Add Team model and controller from upstream
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Services\Community;
|
||||
|
||||
use App\Models\Community\Staff\WebsiteTeam;
|
||||
use App\Models\Community\Teams\WebsiteTeam;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
@@ -20,21 +20,16 @@ class TeamService
|
||||
return Cache::get('hotel_teams');
|
||||
}
|
||||
|
||||
/** @var Collection<int, WebsiteTeam> $employees */
|
||||
$employees = WebsiteTeam::select(['id', 'rank_name', 'badge', 'staff_color', 'staff_background', 'job_description'])
|
||||
->where('hidden_rank', false)
|
||||
->orderByDesc('id')
|
||||
->with(['users' => function ($query): void {
|
||||
/** @var \Illuminate\Database\Eloquent\Builder $query */
|
||||
$query->select('id', 'username', 'look', 'motto', 'rank', 'team_id', 'online');
|
||||
}])
|
||||
/** @var Collection<int, WebsiteTeam> $teams */
|
||||
$teams = WebsiteTeam::where('is_active', true)
|
||||
->orderBy('name')
|
||||
->get();
|
||||
|
||||
if ($cacheEnabled) {
|
||||
$cacheTimer = (int) setting('cache_timer');
|
||||
Cache::put('hotel_teams', $employees, now()->addMinutes($cacheTimer));
|
||||
Cache::put('hotel_teams', $teams, now()->addMinutes($cacheTimer));
|
||||
}
|
||||
|
||||
return $employees;
|
||||
return $teams;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user