mirror of
https://github.com/sp-tarkov/forge.git
synced 2025-02-13 04:30:41 -05:00
Refringe
7fe1fad01b
- Updated visual look of the listing to include all filters at the top of the page - Updated SPT version filter to be able to filter more than one version at a time (defaults to current minor version) - Moved location of Livewire components into subfolder - Moved query building methods for the listing into a `ModFilter` class - Adds a `isLatestMinor` method on the SptVersion model that checks if the current version number is of the latest minor version release - Livewire filter properties are now saved to the URL when changed - Updated the top navigation link to include a "Mods" menu item. TODO: - Search codebase for "TODO". I've left notes. :|
56 lines
1.5 KiB
PHP
56 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Models\ModDependency;
|
|
use App\Models\ModVersion;
|
|
use App\Models\User;
|
|
use App\Observers\ModDependencyObserver;
|
|
use App\Observers\ModVersionObserver;
|
|
use App\Services\LatestSptVersionService;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Support\Facades\Gate;
|
|
use Illuminate\Support\Number;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*/
|
|
public function register(): void
|
|
{
|
|
$this->app->singleton(LatestSptVersionService::class, function ($app) {
|
|
return new LatestSptVersionService;
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
// Allow mass assignment for all models. Be careful!
|
|
Model::unguard();
|
|
|
|
// Register observers.
|
|
ModVersion::observe(ModVersionObserver::class);
|
|
ModDependency::observe(ModDependencyObserver::class);
|
|
|
|
// This gate determines who can access the Pulse dashboard.
|
|
Gate::define('viewPulse', function (User $user) {
|
|
return $user->isAdmin();
|
|
});
|
|
|
|
// Register a number macro to format download numbers.
|
|
Number::macro('downloads', function (int|float $number) {
|
|
return Number::forHumans(
|
|
$number,
|
|
$number > 1000000 ? 2 : ($number > 1000 ? 1 : 0),
|
|
maxPrecision: null,
|
|
abbreviate: true
|
|
);
|
|
});
|
|
}
|
|
}
|