mirror of
https://github.com/sp-tarkov/forge.git
synced 2025-02-12 20:20:41 -05:00
Larastan Level 5
This commit is contained in:
parent
14fcff2b84
commit
a5dcaed179
@ -5,7 +5,6 @@ declare(strict_types=1);
|
|||||||
namespace App\Actions\Fortify;
|
namespace App\Actions\Fortify;
|
||||||
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
|
||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
use Laravel\Fortify\Contracts\UpdatesUserProfileInformation;
|
use Laravel\Fortify\Contracts\UpdatesUserProfileInformation;
|
||||||
@ -32,8 +31,7 @@ class UpdateUserProfileInformation implements UpdatesUserProfileInformation
|
|||||||
$user->updateCoverPhoto($input['cover']);
|
$user->updateCoverPhoto($input['cover']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($input['email'] !== $user->email &&
|
if ($input['email'] !== $user->email) {
|
||||||
$user instanceof MustVerifyEmail) {
|
|
||||||
$this->updateVerifiedUser($user, $input);
|
$this->updateVerifiedUser($user, $input);
|
||||||
} else {
|
} else {
|
||||||
$user->forceFill([
|
$user->forceFill([
|
||||||
|
@ -70,7 +70,7 @@ class SocialiteController extends Controller
|
|||||||
->whereProviderId($providerUser->getId())
|
->whereProviderId($providerUser->getId())
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if ($oauthConnection) {
|
if ($oauthConnection !== null) {
|
||||||
$oauthConnection->update([
|
$oauthConnection->update([
|
||||||
'token' => $providerUser->token ?? '',
|
'token' => $providerUser->token ?? '',
|
||||||
'refresh_token' => $providerUser->refreshToken ?? '',
|
'refresh_token' => $providerUser->refreshToken ?? '',
|
||||||
@ -103,7 +103,7 @@ class SocialiteController extends Controller
|
|||||||
'password' => null,
|
'password' => null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$model = $user->oAuthConnections()->create([
|
$oAuthConnection = $user->oAuthConnections()->create([
|
||||||
'provider' => $provider,
|
'provider' => $provider,
|
||||||
'provider_id' => $providerUser->getId(),
|
'provider_id' => $providerUser->getId(),
|
||||||
'token' => $providerUser->token ?? '',
|
'token' => $providerUser->token ?? '',
|
||||||
@ -114,7 +114,7 @@ class SocialiteController extends Controller
|
|||||||
'avatar' => $providerUser->getAvatar() ?? '',
|
'avatar' => $providerUser->getAvatar() ?? '',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->updateAvatar($user, $model->avatar);
|
$this->updateAvatar($user, $oAuthConnection->avatar);
|
||||||
|
|
||||||
return $user;
|
return $user;
|
||||||
});
|
});
|
||||||
@ -129,10 +129,11 @@ class SocialiteController extends Controller
|
|||||||
};
|
};
|
||||||
|
|
||||||
$curl = curl_init();
|
$curl = curl_init();
|
||||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||||
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
|
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
|
||||||
curl_setopt($curl, CURLOPT_URL, $avatarUrl);
|
curl_setopt($curl, CURLOPT_URL, $avatarUrl);
|
||||||
$image = curl_exec($curl);
|
$image = curl_exec($curl);
|
||||||
|
curl_close($curl);
|
||||||
|
|
||||||
if ($image === false) {
|
if ($image === false) {
|
||||||
Log::error('There was an error attempting to download the image. cURL error: '.curl_error($curl));
|
Log::error('There was an error attempting to download the image. cURL error: '.curl_error($curl));
|
||||||
|
@ -6,6 +6,8 @@ namespace App\Http\Resources\Api\V0;
|
|||||||
|
|
||||||
use App\Http\Controllers\Api\V0\ApiController;
|
use App\Http\Controllers\Api\V0\ApiController;
|
||||||
use App\Models\Mod;
|
use App\Models\Mod;
|
||||||
|
use App\Models\ModVersion;
|
||||||
|
use App\Models\User;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
use Override;
|
use Override;
|
||||||
@ -43,7 +45,7 @@ class ModResource extends JsonResource
|
|||||||
'published_at' => $this->published_at,
|
'published_at' => $this->published_at,
|
||||||
],
|
],
|
||||||
'relationships' => [
|
'relationships' => [
|
||||||
'users' => $this->users->map(fn ($user): array => [
|
'users' => $this->users->map(fn (User $user): array => [
|
||||||
'data' => [
|
'data' => [
|
||||||
'type' => 'user',
|
'type' => 'user',
|
||||||
'id' => $user->id,
|
'id' => $user->id,
|
||||||
@ -52,7 +54,7 @@ class ModResource extends JsonResource
|
|||||||
'self' => $user->profileUrl(),
|
'self' => $user->profileUrl(),
|
||||||
],
|
],
|
||||||
])->toArray(),
|
])->toArray(),
|
||||||
'versions' => $this->versions->map(fn ($version): array => [
|
'versions' => $this->versions->map(fn (ModVersion $version): array => [
|
||||||
'data' => [
|
'data' => [
|
||||||
'type' => 'version',
|
'type' => 'version',
|
||||||
'id' => $version->id,
|
'id' => $version->id,
|
||||||
|
@ -325,7 +325,7 @@ class ImportHubDataJob implements ShouldBeUnique, ShouldQueue
|
|||||||
{
|
{
|
||||||
// Initialize a cURL handler for downloading mod thumbnails.
|
// Initialize a cURL handler for downloading mod thumbnails.
|
||||||
$curl = curl_init();
|
$curl = curl_init();
|
||||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||||
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
|
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
|
||||||
|
|
||||||
DB::connection('mysql_hub')
|
DB::connection('mysql_hub')
|
||||||
@ -894,7 +894,7 @@ class ImportHubDataJob implements ShouldBeUnique, ShouldQueue
|
|||||||
{
|
{
|
||||||
// Initialize a cURL handler for downloading mod thumbnails.
|
// Initialize a cURL handler for downloading mod thumbnails.
|
||||||
$curl = curl_init();
|
$curl = curl_init();
|
||||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||||
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
|
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
|
||||||
|
|
||||||
DB::connection('mysql_hub')
|
DB::connection('mysql_hub')
|
||||||
@ -951,13 +951,13 @@ class ImportHubDataJob implements ShouldBeUnique, ShouldQueue
|
|||||||
$modData[] = [
|
$modData[] = [
|
||||||
'hub_id' => (int) $mod->fileID,
|
'hub_id' => (int) $mod->fileID,
|
||||||
'users' => $modAuthors,
|
'users' => $modAuthors,
|
||||||
'name' => $modContent?->subject ?? '',
|
'name' => $modContent->subject ?? '',
|
||||||
'slug' => Str::slug($modContent?->subject ?? ''),
|
'slug' => Str::slug($modContent->subject ?? ''),
|
||||||
'teaser' => Str::limit($modContent?->teaser ?? '', 255),
|
'teaser' => Str::limit($modContent->teaser ?? '', 255),
|
||||||
'description' => $this->cleanHubContent($modContent?->message ?? ''),
|
'description' => $this->cleanHubContent($modContent->message ?? ''),
|
||||||
'thumbnail' => $this->fetchModThumbnail($curl, $mod->fileID, $mod->iconHash, $mod->iconExtension),
|
'thumbnail' => $this->fetchModThumbnail($curl, $mod->fileID, $mod->iconHash, $mod->iconExtension),
|
||||||
'license_id' => License::whereHubId($mod->licenseID)->value('id'),
|
'license_id' => License::whereHubId($mod->licenseID)->value('id'),
|
||||||
'source_code_link' => $optionSourceCode?->source_code_link ?? '',
|
'source_code_link' => $optionSourceCode->source_code_link ?? '',
|
||||||
'featured' => (bool) $mod->isFeatured,
|
'featured' => (bool) $mod->isFeatured,
|
||||||
'contains_ai_content' => (bool) $optionContainsAi?->contains_ai,
|
'contains_ai_content' => (bool) $optionContainsAi?->contains_ai,
|
||||||
'contains_ads' => (bool) $optionContainsAds?->contains_ads,
|
'contains_ads' => (bool) $optionContainsAds?->contains_ads,
|
||||||
@ -1076,7 +1076,7 @@ class ImportHubDataJob implements ShouldBeUnique, ShouldQueue
|
|||||||
'description' => $this->cleanHubContent($versionContent->description ?? ''),
|
'description' => $this->cleanHubContent($versionContent->description ?? ''),
|
||||||
'link' => $version->downloadURL,
|
'link' => $version->downloadURL,
|
||||||
'spt_version_constraint' => $sptVersionConstraint,
|
'spt_version_constraint' => $sptVersionConstraint,
|
||||||
'virus_total_link' => $optionVirusTotal?->virus_total_link ?? '',
|
'virus_total_link' => $optionVirusTotal->virus_total_link ?? '',
|
||||||
'downloads' => max((int) $version->downloads, 0), // At least 0.
|
'downloads' => max((int) $version->downloads, 0), // At least 0.
|
||||||
'disabled' => (bool) $version->isDisabled,
|
'disabled' => (bool) $version->isDisabled,
|
||||||
'published_at' => $sptVersionConstraint === '0.0.0' ? null : Carbon::parse($version->uploadTime, 'UTC'),
|
'published_at' => $sptVersionConstraint === '0.0.0' ? null : Carbon::parse($version->uploadTime, 'UTC'),
|
||||||
|
@ -114,7 +114,7 @@ class Listing extends Component
|
|||||||
|
|
||||||
$this->redirectOutOfBoundsPage($lengthAwarePaginator);
|
$this->redirectOutOfBoundsPage($lengthAwarePaginator);
|
||||||
|
|
||||||
return view('livewire.mod.listing', ['mods' => $mods]);
|
return view('livewire.mod.listing', ['mods' => $lengthAwarePaginator]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4,11 +4,25 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* License Model
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property int|null $hub_id
|
||||||
|
* @property string $name
|
||||||
|
* @property string $link
|
||||||
|
* @property Carbon|null $created_at
|
||||||
|
* @property Carbon|null $updated_at
|
||||||
|
* @property Carbon|null $deleted_at
|
||||||
|
* @property-read Collection<int, Mod> $mods
|
||||||
|
*/
|
||||||
class License extends Model
|
class License extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
@ -17,7 +31,7 @@ class License extends Model
|
|||||||
/**
|
/**
|
||||||
* The relationship between a license and mod.
|
* The relationship between a license and mod.
|
||||||
*
|
*
|
||||||
* @return HasMany<Mod>
|
* @return HasMany<Mod, $this>
|
||||||
*/
|
*/
|
||||||
public function mods(): HasMany
|
public function mods(): HasMany
|
||||||
{
|
{
|
||||||
|
@ -17,12 +17,40 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
use Illuminate\Support\Facades\Cache;
|
use Illuminate\Support\Facades\Cache;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Laravel\Scout\Searchable;
|
use Laravel\Scout\Searchable;
|
||||||
use Override;
|
use Override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mod Model
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property int|null $hub_id
|
||||||
|
* @property string $name
|
||||||
|
* @property string $slug
|
||||||
|
* @property string $teaser
|
||||||
|
* @property string $description
|
||||||
|
* @property string $thumbnail
|
||||||
|
* @property int|null $license_id
|
||||||
|
* @property int $downloads
|
||||||
|
* @property string $source_code_link
|
||||||
|
* @property bool $featured
|
||||||
|
* @property bool $contains_ai_content
|
||||||
|
* @property bool $contains_ads
|
||||||
|
* @property bool $disabled
|
||||||
|
* @property Carbon|null $created_at
|
||||||
|
* @property Carbon|null $updated_at
|
||||||
|
* @property Carbon|null $deleted_at
|
||||||
|
* @property Carbon|null $published_at
|
||||||
|
* @property-read License|null $license
|
||||||
|
* @property-read Collection<int, User> $users
|
||||||
|
* @property-read Collection<int, ModVersion> $versions
|
||||||
|
* @property-read ModVersion|null $latestVersion
|
||||||
|
* @property-read ModVersion|null $latestUpdatedVersion
|
||||||
|
*/
|
||||||
class Mod extends Model
|
class Mod extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
@ -65,7 +93,7 @@ class Mod extends Model
|
|||||||
/**
|
/**
|
||||||
* The relationship between a mod and its users.
|
* The relationship between a mod and its users.
|
||||||
*
|
*
|
||||||
* @return BelongsToMany<User>
|
* @return BelongsToMany<User, $this>
|
||||||
*/
|
*/
|
||||||
public function users(): BelongsToMany
|
public function users(): BelongsToMany
|
||||||
{
|
{
|
||||||
@ -75,7 +103,7 @@ class Mod extends Model
|
|||||||
/**
|
/**
|
||||||
* The relationship between a mod and its license.
|
* The relationship between a mod and its license.
|
||||||
*
|
*
|
||||||
* @return BelongsTo<License, Mod>
|
* @return BelongsTo<License, $this>
|
||||||
*/
|
*/
|
||||||
public function license(): BelongsTo
|
public function license(): BelongsTo
|
||||||
{
|
{
|
||||||
@ -85,7 +113,7 @@ class Mod extends Model
|
|||||||
/**
|
/**
|
||||||
* The relationship between a mod and its last updated version.
|
* The relationship between a mod and its last updated version.
|
||||||
*
|
*
|
||||||
* @return HasOne<ModVersion>
|
* @return HasOne<ModVersion, $this>
|
||||||
*/
|
*/
|
||||||
public function latestUpdatedVersion(): HasOne
|
public function latestUpdatedVersion(): HasOne
|
||||||
{
|
{
|
||||||
@ -98,7 +126,7 @@ class Mod extends Model
|
|||||||
/**
|
/**
|
||||||
* The relationship between a mod and its versions.
|
* The relationship between a mod and its versions.
|
||||||
*
|
*
|
||||||
* @return HasMany<ModVersion>
|
* @return HasMany<ModVersion, $this>
|
||||||
*/
|
*/
|
||||||
public function versions(): HasMany
|
public function versions(): HasMany
|
||||||
{
|
{
|
||||||
@ -176,7 +204,7 @@ class Mod extends Model
|
|||||||
/**
|
/**
|
||||||
* The relationship between a mod and its latest version.
|
* The relationship between a mod and its latest version.
|
||||||
*
|
*
|
||||||
* @return HasOne<ModVersion>
|
* @return HasOne<ModVersion, $this>
|
||||||
*/
|
*/
|
||||||
public function latestVersion(): HasOne
|
public function latestVersion(): HasOne
|
||||||
{
|
{
|
||||||
|
@ -4,11 +4,26 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ModDependency Model
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property int $mod_version_id
|
||||||
|
* @property int $dependent_mod_id
|
||||||
|
* @property string $constraint
|
||||||
|
* @property Carbon|null $created_at
|
||||||
|
* @property Carbon|null $updated_at
|
||||||
|
* @property-read ModVersion $modVersion
|
||||||
|
* @property-read Mod $dependentMod
|
||||||
|
* @property-read Collection<int, ModResolvedDependency> $resolvedDependencies
|
||||||
|
*/
|
||||||
class ModDependency extends Model
|
class ModDependency extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
@ -16,7 +31,7 @@ class ModDependency extends Model
|
|||||||
/**
|
/**
|
||||||
* The relationship between the mod dependency and the mod version.
|
* The relationship between the mod dependency and the mod version.
|
||||||
*
|
*
|
||||||
* @return BelongsTo<ModVersion, ModDependency>
|
* @return BelongsTo<ModVersion, $this>
|
||||||
*/
|
*/
|
||||||
public function modVersion(): BelongsTo
|
public function modVersion(): BelongsTo
|
||||||
{
|
{
|
||||||
@ -26,7 +41,7 @@ class ModDependency extends Model
|
|||||||
/**
|
/**
|
||||||
* The relationship between the mod dependency and the resolved dependency.
|
* The relationship between the mod dependency and the resolved dependency.
|
||||||
*
|
*
|
||||||
* @return HasMany<ModResolvedDependency>
|
* @return HasMany<ModResolvedDependency, $this>
|
||||||
*/
|
*/
|
||||||
public function resolvedDependencies(): HasMany
|
public function resolvedDependencies(): HasMany
|
||||||
{
|
{
|
||||||
@ -37,7 +52,7 @@ class ModDependency extends Model
|
|||||||
/**
|
/**
|
||||||
* The relationship between the mod dependency and the dependent mod.
|
* The relationship between the mod dependency and the dependent mod.
|
||||||
*
|
*
|
||||||
* @return BelongsTo<Mod, ModDependency>
|
* @return BelongsTo<Mod, $this>
|
||||||
*/
|
*/
|
||||||
public function dependentMod(): BelongsTo
|
public function dependentMod(): BelongsTo
|
||||||
{
|
{
|
||||||
|
@ -4,15 +4,29 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ModResolvedDependency Model
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property int $mod_version_id
|
||||||
|
* @property int $dependency_id
|
||||||
|
* @property int $resolved_mod_version_id
|
||||||
|
* @property Carbon|null $created_at
|
||||||
|
* @property Carbon|null $updated_at
|
||||||
|
* @property-read ModVersion|null $modVersion
|
||||||
|
* @property-read ModDependency|null $dependency
|
||||||
|
* @property-read ModVersion|null $resolvedModVersion
|
||||||
|
*/
|
||||||
class ModResolvedDependency extends Model
|
class ModResolvedDependency extends Model
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The relationship between the resolved dependency and the mod version.
|
* The relationship between the resolved dependency and the mod version.
|
||||||
*
|
*
|
||||||
* @return BelongsTo<ModVersion, ModResolvedDependency>
|
* @return BelongsTo<ModVersion, $this>
|
||||||
*/
|
*/
|
||||||
public function modVersion(): BelongsTo
|
public function modVersion(): BelongsTo
|
||||||
{
|
{
|
||||||
@ -22,7 +36,7 @@ class ModResolvedDependency extends Model
|
|||||||
/**
|
/**
|
||||||
* The relationship between the resolved dependency and the dependency.
|
* The relationship between the resolved dependency and the dependency.
|
||||||
*
|
*
|
||||||
* @return BelongsTo<ModDependency, ModResolvedDependency>
|
* @return BelongsTo<ModDependency, $this>
|
||||||
*/
|
*/
|
||||||
public function dependency(): BelongsTo
|
public function dependency(): BelongsTo
|
||||||
{
|
{
|
||||||
@ -32,7 +46,7 @@ class ModResolvedDependency extends Model
|
|||||||
/**
|
/**
|
||||||
* The relationship between the resolved dependency and the resolved mod version.
|
* The relationship between the resolved dependency and the resolved mod version.
|
||||||
*
|
*
|
||||||
* @return BelongsTo<ModVersion, ModResolvedDependency>
|
* @return BelongsTo<ModVersion, $this>
|
||||||
*/
|
*/
|
||||||
public function resolvedModVersion(): BelongsTo
|
public function resolvedModVersion(): BelongsTo
|
||||||
{
|
{
|
||||||
|
@ -8,6 +8,7 @@ use App\Exceptions\InvalidVersionNumberException;
|
|||||||
use App\Models\Scopes\DisabledScope;
|
use App\Models\Scopes\DisabledScope;
|
||||||
use App\Models\Scopes\PublishedScope;
|
use App\Models\Scopes\PublishedScope;
|
||||||
use App\Support\Version;
|
use App\Support\Version;
|
||||||
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
@ -15,8 +16,37 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasOneThrough;
|
use Illuminate\Database\Eloquent\Relations\HasOneThrough;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
use Override;
|
use Override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ModVersion Model
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property int|null $hub_id
|
||||||
|
* @property int $mod_id
|
||||||
|
* @property string $version
|
||||||
|
* @property int $version_major
|
||||||
|
* @property int $version_minor
|
||||||
|
* @property int $version_patch
|
||||||
|
* @property string $version_pre_release
|
||||||
|
* @property string $description
|
||||||
|
* @property string $link
|
||||||
|
* @property string $spt_version_constraint
|
||||||
|
* @property string $virus_total_link
|
||||||
|
* @property int $downloads
|
||||||
|
* @property bool $disabled
|
||||||
|
* @property Carbon|null $deleted_at
|
||||||
|
* @property Carbon|null $published_at
|
||||||
|
* @property Carbon $created_at
|
||||||
|
* @property Carbon $updated_at
|
||||||
|
* @property-read Mod $mod
|
||||||
|
* @property-read Collection<int, ModDependency> $dependencies
|
||||||
|
* @property-read Collection<int, ModVersion> $resolvedDependencies
|
||||||
|
* @property-read Collection<int, ModVersion> $latestResolvedDependencies
|
||||||
|
* @property-read SptVersion|null $latestSptVersion
|
||||||
|
* @property-read Collection<int, SptVersion> $sptVersions
|
||||||
|
*/
|
||||||
class ModVersion extends Model
|
class ModVersion extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
@ -58,7 +88,7 @@ class ModVersion extends Model
|
|||||||
/**
|
/**
|
||||||
* The relationship between a mod version and mod.
|
* The relationship between a mod version and mod.
|
||||||
*
|
*
|
||||||
* @return BelongsTo<Mod, ModVersion>
|
* @return BelongsTo<Mod, $this>
|
||||||
*/
|
*/
|
||||||
public function mod(): BelongsTo
|
public function mod(): BelongsTo
|
||||||
{
|
{
|
||||||
@ -68,7 +98,7 @@ class ModVersion extends Model
|
|||||||
/**
|
/**
|
||||||
* The relationship between a mod version and its dependencies.
|
* The relationship between a mod version and its dependencies.
|
||||||
*
|
*
|
||||||
* @return HasMany<ModDependency>
|
* @return HasMany<ModDependency, $this>
|
||||||
*/
|
*/
|
||||||
public function dependencies(): HasMany
|
public function dependencies(): HasMany
|
||||||
{
|
{
|
||||||
@ -79,7 +109,7 @@ class ModVersion extends Model
|
|||||||
/**
|
/**
|
||||||
* The relationship between a mod version and its resolved dependencies.
|
* The relationship between a mod version and its resolved dependencies.
|
||||||
*
|
*
|
||||||
* @return BelongsToMany<ModVersion>
|
* @return BelongsToMany<ModVersion, $this>
|
||||||
*/
|
*/
|
||||||
public function resolvedDependencies(): BelongsToMany
|
public function resolvedDependencies(): BelongsToMany
|
||||||
{
|
{
|
||||||
@ -91,7 +121,7 @@ class ModVersion extends Model
|
|||||||
/**
|
/**
|
||||||
* The relationship between a mod version and its each of it's resolved dependencies' latest versions.
|
* The relationship between a mod version and its each of it's resolved dependencies' latest versions.
|
||||||
*
|
*
|
||||||
* @return BelongsToMany<ModVersion>
|
* @return BelongsToMany<ModVersion, $this>
|
||||||
*/
|
*/
|
||||||
public function latestResolvedDependencies(): BelongsToMany
|
public function latestResolvedDependencies(): BelongsToMany
|
||||||
{
|
{
|
||||||
@ -108,7 +138,7 @@ class ModVersion extends Model
|
|||||||
/**
|
/**
|
||||||
* The relationship between a mod version and its latest SPT version.
|
* The relationship between a mod version and its latest SPT version.
|
||||||
*
|
*
|
||||||
* @return HasOneThrough<SptVersion>
|
* @return HasOneThrough<SptVersion, ModVersionSptVersion, $this>
|
||||||
*/
|
*/
|
||||||
public function latestSptVersion(): HasOneThrough
|
public function latestSptVersion(): HasOneThrough
|
||||||
{
|
{
|
||||||
@ -123,7 +153,7 @@ class ModVersion extends Model
|
|||||||
/**
|
/**
|
||||||
* The relationship between a mod version and its SPT versions.
|
* The relationship between a mod version and its SPT versions.
|
||||||
*
|
*
|
||||||
* @return BelongsToMany<SptVersion>
|
* @return BelongsToMany<SptVersion, $this>
|
||||||
*/
|
*/
|
||||||
public function sptVersions(): BelongsToMany
|
public function sptVersions(): BelongsToMany
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,15 @@ namespace App\Models;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Relations\Pivot;
|
use Illuminate\Database\Eloquent\Relations\Pivot;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ModVersionSptVersion Pivot Model
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property int $mod_version_id
|
||||||
|
* @property int $spt_version_id
|
||||||
|
* @property-read ModVersion $modVersion
|
||||||
|
* @property-read SptVersion $sptVersion
|
||||||
|
*/
|
||||||
class ModVersionSptVersion extends Pivot
|
class ModVersionSptVersion extends Pivot
|
||||||
{
|
{
|
||||||
public $incrementing = true;
|
public $incrementing = true;
|
||||||
|
@ -4,16 +4,39 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OAuthConnection Model
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property int $user_id
|
||||||
|
* @property string $provider
|
||||||
|
* @property string $provider_id
|
||||||
|
* @property string $token
|
||||||
|
* @property string $refresh_token
|
||||||
|
* @property string $nickname
|
||||||
|
* @property string $name
|
||||||
|
* @property string $email
|
||||||
|
* @property string $avatar
|
||||||
|
* @property Carbon $created_at
|
||||||
|
* @property Carbon $updated_at
|
||||||
|
* @property-read User $user
|
||||||
|
*/
|
||||||
class OAuthConnection extends Model
|
class OAuthConnection extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
protected $table = 'oauth_connections';
|
protected $table = 'oauth_connections';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The relationship between the OAuth connection and the user.
|
||||||
|
*
|
||||||
|
* @return BelongsTo<User, $this>
|
||||||
|
*/
|
||||||
public function user(): BelongsTo
|
public function user(): BelongsTo
|
||||||
{
|
{
|
||||||
return $this->belongsTo(User::class);
|
return $this->belongsTo(User::class);
|
||||||
|
@ -6,6 +6,7 @@ namespace App\Models;
|
|||||||
|
|
||||||
use App\Exceptions\InvalidVersionNumberException;
|
use App\Exceptions\InvalidVersionNumberException;
|
||||||
use App\Support\Version;
|
use App\Support\Version;
|
||||||
|
use Carbon\Carbon;
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
@ -13,7 +14,27 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Illuminate\Support\Facades\Cache;
|
use Illuminate\Support\Facades\Cache;
|
||||||
use Override;
|
use Override;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SptVersion Model
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property int|null $hub_id
|
||||||
|
* @property string $version
|
||||||
|
* @property int $version_major
|
||||||
|
* @property int $version_minor
|
||||||
|
* @property int $version_patch
|
||||||
|
* @property string $version_pre_release
|
||||||
|
* @property int $mod_count
|
||||||
|
* @property string $link
|
||||||
|
* @property string $color_class
|
||||||
|
* @property Carbon|null $deleted_at
|
||||||
|
* @property Carbon $created_at
|
||||||
|
* @property Carbon $updated_at
|
||||||
|
* @property-read Collection<int, ModVersion> $modVersions
|
||||||
|
* @property-read string $version_formatted
|
||||||
|
*/
|
||||||
class SptVersion extends Model
|
class SptVersion extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
@ -69,7 +90,7 @@ class SptVersion extends Model
|
|||||||
/**
|
/**
|
||||||
* Extract the version sections from the version string.
|
* Extract the version sections from the version string.
|
||||||
*
|
*
|
||||||
* @throws InvalidVersionNumberException
|
* @throws InvalidVersionNumberException|Throwable
|
||||||
*/
|
*/
|
||||||
public static function extractVersionSections(string $version): array
|
public static function extractVersionSections(string $version): array
|
||||||
{
|
{
|
||||||
@ -128,7 +149,7 @@ class SptVersion extends Model
|
|||||||
/**
|
/**
|
||||||
* The relationship between an SPT version and mod version.
|
* The relationship between an SPT version and mod version.
|
||||||
*
|
*
|
||||||
* @return BelongsToMany<ModVersion>
|
* @return BelongsToMany<ModVersion, $this>
|
||||||
*/
|
*/
|
||||||
public function modVersions(): BelongsToMany
|
public function modVersions(): BelongsToMany
|
||||||
{
|
{
|
||||||
|
@ -8,9 +8,11 @@ use App\Http\Filters\V1\QueryFilter;
|
|||||||
use App\Notifications\ResetPassword;
|
use App\Notifications\ResetPassword;
|
||||||
use App\Notifications\VerifyEmail;
|
use App\Notifications\VerifyEmail;
|
||||||
use App\Traits\HasCoverPhoto;
|
use App\Traits\HasCoverPhoto;
|
||||||
|
use Carbon\Carbon;
|
||||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
@ -25,6 +27,28 @@ use Laravel\Scout\Searchable;
|
|||||||
use Mchev\Banhammer\Traits\Bannable;
|
use Mchev\Banhammer\Traits\Bannable;
|
||||||
use SensitiveParameter;
|
use SensitiveParameter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property int $id
|
||||||
|
* @property int|null $hub_id
|
||||||
|
* @property int|null $discord_id
|
||||||
|
* @property string $name
|
||||||
|
* @property string $email
|
||||||
|
* @property Carbon|null $email_verified_at
|
||||||
|
* @property string|null $password
|
||||||
|
* @property string $about
|
||||||
|
* @property int|null $user_role_id
|
||||||
|
* @property string|null $remember_token
|
||||||
|
* @property string|null $profile_photo_path
|
||||||
|
* @property string|null $cover_photo_path
|
||||||
|
* @property Carbon $created_at
|
||||||
|
* @property Carbon $updated_at
|
||||||
|
* @property-read string $profile_photo_url
|
||||||
|
* @property-read UserRole|null $role
|
||||||
|
* @property-read Collection<int, Mod> $mods
|
||||||
|
* @property-read Collection<int, User> $followers
|
||||||
|
* @property-read Collection<int, User> $following
|
||||||
|
* @property-read Collection<int, OAuthConnection> $oAuthConnections
|
||||||
|
*/
|
||||||
class User extends Authenticatable implements MustVerifyEmail
|
class User extends Authenticatable implements MustVerifyEmail
|
||||||
{
|
{
|
||||||
use Bannable;
|
use Bannable;
|
||||||
@ -58,7 +82,7 @@ class User extends Authenticatable implements MustVerifyEmail
|
|||||||
/**
|
/**
|
||||||
* The relationship between a user and their mods.
|
* The relationship between a user and their mods.
|
||||||
*
|
*
|
||||||
* @return BelongsToMany<Mod>
|
* @return BelongsToMany<Mod, $this>
|
||||||
*/
|
*/
|
||||||
public function mods(): BelongsToMany
|
public function mods(): BelongsToMany
|
||||||
{
|
{
|
||||||
@ -68,7 +92,7 @@ class User extends Authenticatable implements MustVerifyEmail
|
|||||||
/**
|
/**
|
||||||
* The relationship between a user and users that follow them.
|
* The relationship between a user and users that follow them.
|
||||||
*
|
*
|
||||||
* @return BelongsToMany<User>
|
* @return BelongsToMany<User, $this>
|
||||||
*/
|
*/
|
||||||
public function followers(): BelongsToMany
|
public function followers(): BelongsToMany
|
||||||
{
|
{
|
||||||
@ -94,7 +118,7 @@ class User extends Authenticatable implements MustVerifyEmail
|
|||||||
/**
|
/**
|
||||||
* The relationship between a user and users they follow.
|
* The relationship between a user and users they follow.
|
||||||
*
|
*
|
||||||
* @return BelongsToMany<User>
|
* @return BelongsToMany<User, $this>
|
||||||
*/
|
*/
|
||||||
public function following(): BelongsToMany
|
public function following(): BelongsToMany
|
||||||
{
|
{
|
||||||
@ -209,7 +233,7 @@ class User extends Authenticatable implements MustVerifyEmail
|
|||||||
/**
|
/**
|
||||||
* The relationship between a user and their role.
|
* The relationship between a user and their role.
|
||||||
*
|
*
|
||||||
* @return BelongsTo<UserRole, User>
|
* @return BelongsTo<UserRole, $this>
|
||||||
*/
|
*/
|
||||||
public function role(): BelongsTo
|
public function role(): BelongsTo
|
||||||
{
|
{
|
||||||
@ -226,6 +250,8 @@ class User extends Authenticatable implements MustVerifyEmail
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The relationship between a user and their OAuth providers.
|
* The relationship between a user and their OAuth providers.
|
||||||
|
*
|
||||||
|
* @return HasMany<OAuthConnection, $this>
|
||||||
*/
|
*/
|
||||||
public function oAuthConnections(): HasMany
|
public function oAuthConnections(): HasMany
|
||||||
{
|
{
|
||||||
|
@ -4,10 +4,24 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UserRole Model
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property string $name
|
||||||
|
* @property string $short_name
|
||||||
|
* @property string $description
|
||||||
|
* @property string $color_class
|
||||||
|
* @property Carbon $created_at
|
||||||
|
* @property Carbon $updated_at
|
||||||
|
* @property-read Collection<int, User> $users
|
||||||
|
*/
|
||||||
class UserRole extends Model
|
class UserRole extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
@ -15,7 +29,7 @@ class UserRole extends Model
|
|||||||
/**
|
/**
|
||||||
* The relationship between a user role and users.
|
* The relationship between a user role and users.
|
||||||
*
|
*
|
||||||
* @return HasMany<User>
|
* @return HasMany<User, $this>
|
||||||
*/
|
*/
|
||||||
public function users(): HasMany
|
public function users(): HasMany
|
||||||
{
|
{
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
"driftingly/rector-laravel": "^2.0",
|
"driftingly/rector-laravel": "^2.0",
|
||||||
"fakerphp/faker": "^1.24.1",
|
"fakerphp/faker": "^1.24.1",
|
||||||
"knuckleswtf/scribe": "^4.39",
|
"knuckleswtf/scribe": "^4.39",
|
||||||
"larastan/larastan": "^3.0.2",
|
"larastan/larastan": "^3.0",
|
||||||
"laravel/pint": "^1.20",
|
"laravel/pint": "^1.20",
|
||||||
"laravel/sail": "^1.40",
|
"laravel/sail": "^1.40",
|
||||||
"mockery/mockery": "^1.6.12",
|
"mockery/mockery": "^1.6.12",
|
||||||
|
2
composer.lock
generated
2
composer.lock
generated
@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "3401287e9f3115f4af4f8ed65cbeedf1",
|
"content-hash": "d44788dcb87d3c0edc41c96b9f84b810",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "anourvalar/eloquent-serialize",
|
"name": "anourvalar/eloquent-serialize",
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
includes:
|
includes:
|
||||||
- ./vendor/larastan/larastan/extension.neon
|
- vendor/larastan/larastan/extension.neon
|
||||||
|
- vendor/nesbot/carbon/extension.neon
|
||||||
parameters:
|
parameters:
|
||||||
level: 5
|
level: 5
|
||||||
paths:
|
paths:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user