mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-07-11 01:24:46 +02:00
docs: clean unnecessary docs (#942)
This commit is contained in:
@@ -12,33 +12,21 @@ class ActionResult
|
||||
{
|
||||
public function __construct(protected readonly ActionStatus $status, protected readonly ?string $message = null) {}
|
||||
|
||||
/**
|
||||
* Get the action result status.
|
||||
*/
|
||||
public function getStatus(): ActionStatus
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the action result message.
|
||||
*/
|
||||
public function getMessage(): ?string
|
||||
{
|
||||
return $this->message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Has the action failed?
|
||||
*/
|
||||
public function hasFailed(): bool
|
||||
{
|
||||
return $this->status === ActionStatus::FAILED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write results to log.
|
||||
*/
|
||||
public function toLog(): void
|
||||
{
|
||||
$this->hasFailed()
|
||||
@@ -46,9 +34,6 @@ class ActionResult
|
||||
: Log::info($this->getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* Write results to console output.
|
||||
*/
|
||||
public function toConsole(Command $command): void
|
||||
{
|
||||
$this->hasFailed()
|
||||
|
||||
@@ -22,8 +22,6 @@ class DiscordMessageAction
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the Discord message.
|
||||
*
|
||||
* @param array<string, mixed> $fields
|
||||
*/
|
||||
public function makeMessage(array $fields): DiscordMessage
|
||||
@@ -46,9 +44,6 @@ class DiscordMessageAction
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Discord message.
|
||||
*/
|
||||
public function get(string $url): DiscordMessage
|
||||
{
|
||||
$message = static::getHttp()
|
||||
@@ -61,9 +56,6 @@ class DiscordMessageAction
|
||||
return DiscordMessage::from(Arr::get($message, 'message'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit the Discord message.
|
||||
*/
|
||||
public function edit(DiscordMessage $message): void
|
||||
{
|
||||
static::getHttp()
|
||||
@@ -73,9 +65,6 @@ class DiscordMessageAction
|
||||
->throw();
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the Discord message.
|
||||
*/
|
||||
public function send(DiscordMessage $message): void
|
||||
{
|
||||
static::getHttp()
|
||||
|
||||
@@ -13,8 +13,6 @@ use Illuminate\Support\Facades\Log;
|
||||
class DiscordThreadAction
|
||||
{
|
||||
/**
|
||||
* Handle the action.
|
||||
*
|
||||
* @param array<string, mixed> $fields
|
||||
*/
|
||||
public function handle(Anime $anime, array $fields): ?Exception
|
||||
|
||||
@@ -12,8 +12,6 @@ use Illuminate\Support\Collection;
|
||||
class DiscordVideoNotificationAction
|
||||
{
|
||||
/**
|
||||
* Handle the action.
|
||||
*
|
||||
* @param Collection<int, Video> $videos
|
||||
* @param array<string, mixed> $fields
|
||||
*/
|
||||
|
||||
@@ -10,8 +10,6 @@ use App\Models\Admin\Dump;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
|
||||
/**
|
||||
* Class DumpDownloadAction.
|
||||
*
|
||||
* @extends DownloadAction<Dump>
|
||||
*/
|
||||
class DumpDownloadAction extends DownloadAction
|
||||
@@ -29,9 +27,6 @@ class DumpDownloadAction extends DownloadAction
|
||||
return $this->model->path;
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the disk.
|
||||
*/
|
||||
public function disk(): string
|
||||
{
|
||||
return Config::get(DumpConstants::DISK_QUALIFIED);
|
||||
|
||||
@@ -9,15 +9,11 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* Class DestroyAction.
|
||||
*
|
||||
* @template TModel of \Illuminate\Database\Eloquent\Model
|
||||
*/
|
||||
class DestroyAction
|
||||
{
|
||||
/**
|
||||
* Destroy model.
|
||||
*
|
||||
* @param TModel $model
|
||||
* @return TModel
|
||||
*/
|
||||
|
||||
@@ -9,9 +9,6 @@ use Illuminate\Support\Str;
|
||||
|
||||
class ForceDeleteAction
|
||||
{
|
||||
/**
|
||||
* Force delete model.
|
||||
*/
|
||||
public function forceDelete(BaseModel $model): string
|
||||
{
|
||||
$message = Str::of(Str::headline(class_basename($model)))
|
||||
|
||||
@@ -58,9 +58,6 @@ class IndexAction
|
||||
: $builder->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Search models.
|
||||
*/
|
||||
public function search(
|
||||
Query $query,
|
||||
Schema $schema,
|
||||
@@ -78,9 +75,6 @@ class IndexAction
|
||||
throw new RuntimeException("Can't search for term '$term' with driver '$driver' and type '{$schema->type()}'");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the search instance.
|
||||
*/
|
||||
protected function getSearch(): ?Search
|
||||
{
|
||||
return match (Config::get('scout.driver')) {
|
||||
|
||||
@@ -16,8 +16,6 @@ use Illuminate\Support\Str;
|
||||
class DestroyTrackAction
|
||||
{
|
||||
/**
|
||||
* Destroy playlist track.
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function destroy(Playlist $playlist, PlaylistTrack $track): string
|
||||
|
||||
@@ -20,8 +20,6 @@ use Illuminate\Support\Facades\Log;
|
||||
class StoreTrackAction
|
||||
{
|
||||
/**
|
||||
* Store playlist track.
|
||||
*
|
||||
* @param array $parameters
|
||||
*
|
||||
* @throws Exception
|
||||
|
||||
@@ -19,8 +19,6 @@ use Illuminate\Support\Facades\Log;
|
||||
class UpdateTrackAction
|
||||
{
|
||||
/**
|
||||
* Store playlist track.
|
||||
*
|
||||
* @param array $parameters
|
||||
*
|
||||
* @throws Exception
|
||||
|
||||
@@ -9,9 +9,6 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RestoreAction
|
||||
{
|
||||
/**
|
||||
* Restore model.
|
||||
*/
|
||||
public function restore(Model&SoftDeletable $model): Model&SoftDeletable
|
||||
{
|
||||
$model->restore();
|
||||
|
||||
@@ -13,9 +13,6 @@ class ShowAction
|
||||
{
|
||||
use ConstrainsEagerLoads;
|
||||
|
||||
/**
|
||||
* Show model.
|
||||
*/
|
||||
public function show(Model $model, Query $query, Schema $schema): Model
|
||||
{
|
||||
// eager load relations with constraints
|
||||
|
||||
@@ -8,15 +8,11 @@ use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class StoreAction.
|
||||
*
|
||||
* @template TModel of \Illuminate\Database\Eloquent\Model
|
||||
*/
|
||||
class StoreAction
|
||||
{
|
||||
/**
|
||||
* Store model.
|
||||
*
|
||||
* @param Builder<TModel> $builder
|
||||
* @param array $parameters
|
||||
* @return TModel
|
||||
|
||||
@@ -7,15 +7,11 @@ namespace App\Actions\Http\Api;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class UpdateAction.
|
||||
*
|
||||
* @template TModel of \Illuminate\Database\Eloquent\Model
|
||||
*/
|
||||
class UpdateAction
|
||||
{
|
||||
/**
|
||||
* Update model.
|
||||
*
|
||||
* @param TModel $model
|
||||
* @param array $parameters
|
||||
* @return TModel
|
||||
|
||||
@@ -15,15 +15,11 @@ use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
/**
|
||||
* Class StoreImageAction.
|
||||
*
|
||||
* @extends StoreAction<Image>
|
||||
*/
|
||||
class StoreImageAction extends StoreAction
|
||||
{
|
||||
/**
|
||||
* Store image.
|
||||
*
|
||||
* @param Builder<Image> $builder
|
||||
* @param array $parameters
|
||||
*/
|
||||
|
||||
@@ -11,8 +11,6 @@ use Illuminate\Support\Facades\Storage;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
|
||||
/**
|
||||
* Class DownloadAction.
|
||||
*
|
||||
* @template TModel of \App\Models\BaseModel
|
||||
*/
|
||||
abstract class DownloadAction implements InteractsWithDisk
|
||||
@@ -22,9 +20,6 @@ abstract class DownloadAction implements InteractsWithDisk
|
||||
*/
|
||||
public function __construct(protected readonly BaseModel $model) {}
|
||||
|
||||
/**
|
||||
* Download the resource.
|
||||
*/
|
||||
public function download(): StreamedResponse
|
||||
{
|
||||
/** @var FilesystemAdapter $fs */
|
||||
|
||||
@@ -10,9 +10,6 @@ use Illuminate\Support\Facades\Storage;
|
||||
|
||||
abstract class NginxStreamAction extends StreamAction
|
||||
{
|
||||
/**
|
||||
* Stream the resource.
|
||||
*/
|
||||
public function stream(string $disposition = 'inline'): Response
|
||||
{
|
||||
/** @var FilesystemAdapter $fs */
|
||||
|
||||
@@ -9,9 +9,6 @@ use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
|
||||
abstract class ResponseStreamAction extends StreamAction
|
||||
{
|
||||
/**
|
||||
* Stream the resource.
|
||||
*/
|
||||
public function stream(string $disposition = 'inline'): StreamedResponse
|
||||
{
|
||||
$response = new StreamedResponse();
|
||||
|
||||
@@ -12,8 +12,5 @@ abstract class StreamAction implements InteractsWithDisk
|
||||
{
|
||||
public function __construct(protected readonly Streamable $streamable) {}
|
||||
|
||||
/**
|
||||
* Stream the resource.
|
||||
*/
|
||||
abstract public function stream(string $disposition = 'inline'): Response;
|
||||
}
|
||||
|
||||
@@ -16,9 +16,6 @@ class AudioNginxStreamAction extends NginxStreamAction
|
||||
parent::__construct($audio);
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the disk.
|
||||
*/
|
||||
public function disk(): string
|
||||
{
|
||||
return Config::get(AudioConstants::DEFAULT_DISK_QUALIFIED);
|
||||
|
||||
@@ -16,9 +16,6 @@ class AudioResponseStreamAction extends ResponseStreamAction
|
||||
parent::__construct($audio);
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the disk.
|
||||
*/
|
||||
public function disk(): string
|
||||
{
|
||||
return Config::get(AudioConstants::DEFAULT_DISK_QUALIFIED);
|
||||
|
||||
@@ -10,8 +10,6 @@ use App\Models\Wiki\Video\VideoScript;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
|
||||
/**
|
||||
* Class ScriptDownloadAction.
|
||||
*
|
||||
* @extends DownloadAction<VideoScript>
|
||||
*/
|
||||
class ScriptDownloadAction extends DownloadAction
|
||||
@@ -29,9 +27,6 @@ class ScriptDownloadAction extends DownloadAction
|
||||
return $this->model->path;
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the disk.
|
||||
*/
|
||||
public function disk(): string
|
||||
{
|
||||
return Config::get(VideoConstants::SCRIPT_DISK_QUALIFIED);
|
||||
|
||||
@@ -16,9 +16,6 @@ class VideoNginxStreamAction extends NginxStreamAction
|
||||
parent::__construct($video);
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the disk.
|
||||
*/
|
||||
public function disk(): string
|
||||
{
|
||||
return Config::get(VideoConstants::DEFAULT_DISK_QUALIFIED);
|
||||
|
||||
@@ -16,9 +16,6 @@ class VideoResponseStreamAction extends ResponseStreamAction
|
||||
parent::__construct($video);
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the disk.
|
||||
*/
|
||||
public function disk(): string
|
||||
{
|
||||
return Config::get(VideoConstants::DEFAULT_DISK_QUALIFIED);
|
||||
|
||||
@@ -12,8 +12,6 @@ use Illuminate\Support\Facades\DB;
|
||||
class SyncLikeAggregatesAction
|
||||
{
|
||||
/**
|
||||
* Handles the action.
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function handle(): ActionResult
|
||||
|
||||
@@ -12,8 +12,6 @@ use Illuminate\Support\Facades\DB;
|
||||
class SyncViewAggregatesAction
|
||||
{
|
||||
/**
|
||||
* Handles the action.
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function handle(): ActionResult
|
||||
|
||||
@@ -10,9 +10,6 @@ use Vinkla\Hashids\Facades\Hashids;
|
||||
|
||||
class AssignHashidsAction
|
||||
{
|
||||
/**
|
||||
* Assign Hashids to model.
|
||||
*/
|
||||
public function assign(HasHashids&BaseModel $model, ?string $connection = null): void
|
||||
{
|
||||
$hashids = Hashids::connection($connection);
|
||||
|
||||
@@ -10,8 +10,6 @@ use Illuminate\Database\Eloquent\Relations\Relation;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* Class BackfillAction.
|
||||
*
|
||||
* @template TModel of \App\Models\BaseModel
|
||||
*/
|
||||
abstract class BackfillAction
|
||||
@@ -21,9 +19,6 @@ abstract class BackfillAction
|
||||
*/
|
||||
public function __construct(protected BaseModel $model) {}
|
||||
|
||||
/**
|
||||
* Handle action.
|
||||
*/
|
||||
abstract public function handle(): ActionResult;
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,9 +32,6 @@ abstract class BackfillWikiAction
|
||||
*/
|
||||
public function __construct(protected BaseModel $model, protected array $toBackfill) {}
|
||||
|
||||
/**
|
||||
* Handle the action.
|
||||
*/
|
||||
abstract public function handle(): ActionResult;
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,8 +9,6 @@ use Illuminate\Http\Client\RequestException;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
|
||||
/**
|
||||
* Class BaseExternalEntryClaimedAction.
|
||||
*
|
||||
* This action will create the entries through the authentication method.
|
||||
*/
|
||||
abstract class BaseExternalEntryClaimedAction
|
||||
@@ -29,25 +27,16 @@ abstract class BaseExternalEntryClaimedAction
|
||||
|
||||
public function __construct(protected ExternalToken $token) {}
|
||||
|
||||
/**
|
||||
* Get the id of the external user.
|
||||
*/
|
||||
public function getUserId(): ?int
|
||||
{
|
||||
return $this->userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the token to the request.
|
||||
*/
|
||||
protected function getToken(): string
|
||||
{
|
||||
return Crypt::decrypt($this->token->access_token);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the username.
|
||||
*/
|
||||
abstract public function getUsername(): ?string;
|
||||
|
||||
/**
|
||||
@@ -58,8 +47,6 @@ abstract class BaseExternalEntryClaimedAction
|
||||
abstract public function getEntries(): array;
|
||||
|
||||
/**
|
||||
* Make the request to the external api.
|
||||
*
|
||||
* @throws RequestException
|
||||
*/
|
||||
abstract protected function makeRequest(): void;
|
||||
|
||||
+1
-11
@@ -9,8 +9,6 @@ use Illuminate\Http\Client\RequestException;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
/**
|
||||
* Class BaseExternalEntryUnclaimedAction.
|
||||
*
|
||||
* This action will create the entries through the username method.
|
||||
*/
|
||||
abstract class BaseExternalEntryUnclaimedAction
|
||||
@@ -27,9 +25,6 @@ abstract class BaseExternalEntryUnclaimedAction
|
||||
*/
|
||||
public function __construct(protected ExternalProfile|array $profile) {}
|
||||
|
||||
/**
|
||||
* Get the username of the profile.
|
||||
*/
|
||||
public function getUsername(): string
|
||||
{
|
||||
if ($this->profile instanceof ExternalProfile) {
|
||||
@@ -39,10 +34,7 @@ abstract class BaseExternalEntryUnclaimedAction
|
||||
return Arr::get($this->profile, ExternalProfile::ATTRIBUTE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the id of the external user.
|
||||
*/
|
||||
abstract public function getId(): ?int;
|
||||
abstract public function getUserId(): ?int;
|
||||
|
||||
/**
|
||||
* Get the entries of the response.
|
||||
@@ -52,8 +44,6 @@ abstract class BaseExternalEntryUnclaimedAction
|
||||
abstract public function getEntries(): array;
|
||||
|
||||
/**
|
||||
* Make the request to the external api.
|
||||
*
|
||||
* @throws RequestException
|
||||
*/
|
||||
abstract protected function makeRequest(): void;
|
||||
|
||||
-8
@@ -47,9 +47,6 @@ class AnilistExternalEntryClaimedAction extends BaseExternalEntryClaimedAction
|
||||
return $entries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the username.
|
||||
*/
|
||||
public function getUsername(): ?string
|
||||
{
|
||||
if ($this->data === null) {
|
||||
@@ -59,9 +56,6 @@ class AnilistExternalEntryClaimedAction extends BaseExternalEntryClaimedAction
|
||||
return Arr::get($this->data, 'Viewer.name');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the id of the external user.
|
||||
*/
|
||||
public function getUserId(): ?int
|
||||
{
|
||||
if ($this->userId !== null) {
|
||||
@@ -78,8 +72,6 @@ class AnilistExternalEntryClaimedAction extends BaseExternalEntryClaimedAction
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the request to the external api.
|
||||
*
|
||||
* @throws RequestException
|
||||
*/
|
||||
protected function makeRequest(): void
|
||||
|
||||
-10
@@ -58,9 +58,6 @@ class MalExternalEntryClaimedAction extends BaseExternalEntryClaimedAction
|
||||
return $entries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the username.
|
||||
*/
|
||||
public function getUsername(): ?string
|
||||
{
|
||||
if ($this->userData === null) {
|
||||
@@ -70,9 +67,6 @@ class MalExternalEntryClaimedAction extends BaseExternalEntryClaimedAction
|
||||
return Arr::get($this->userData, 'name');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the id of the external user.
|
||||
*/
|
||||
public function getUserId(): ?int
|
||||
{
|
||||
if ($this->data === null) {
|
||||
@@ -83,8 +77,6 @@ class MalExternalEntryClaimedAction extends BaseExternalEntryClaimedAction
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the request to the user endpoint of the external api.
|
||||
*
|
||||
* @throws RequestException
|
||||
*/
|
||||
protected function makeUserRequest(): void
|
||||
@@ -102,8 +94,6 @@ class MalExternalEntryClaimedAction extends BaseExternalEntryClaimedAction
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the request to the external api.
|
||||
*
|
||||
* @throws RequestException
|
||||
*/
|
||||
protected function makeRequest(): void
|
||||
|
||||
+1
-6
@@ -46,10 +46,7 @@ class AnilistExternalEntryUnclaimedAction extends BaseExternalEntryUnclaimedActi
|
||||
return $entries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the id of the external user.
|
||||
*/
|
||||
public function getId(): ?int
|
||||
public function getUserId(): ?int
|
||||
{
|
||||
if ($this->data === null) {
|
||||
$this->makeRequest();
|
||||
@@ -59,8 +56,6 @@ class AnilistExternalEntryUnclaimedAction extends BaseExternalEntryUnclaimedActi
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the request to the external api.
|
||||
*
|
||||
* @throws RequestException
|
||||
*/
|
||||
protected function makeRequest(): void
|
||||
|
||||
@@ -58,7 +58,7 @@ class StoreExternalProfileUnclaimedAction
|
||||
|
||||
/** @var ExternalProfile $profile */
|
||||
$profile = $storeAction->store($builder, [
|
||||
ExternalProfile::ATTRIBUTE_EXTERNAL_USER_ID => $action->getId(),
|
||||
ExternalProfile::ATTRIBUTE_EXTERNAL_USER_ID => $action->getUserId(),
|
||||
ExternalProfile::ATTRIBUTE_NAME => $name,
|
||||
ExternalProfile::ATTRIBUTE_SITE => $profileSite->value,
|
||||
ExternalProfile::ATTRIBUTE_VISIBILITY => ExternalProfileVisibility::fromLocalizedName($visibilityLocalized)->value,
|
||||
|
||||
@@ -24,8 +24,6 @@ class SyncExternalProfileAction
|
||||
protected Collection $resources;
|
||||
|
||||
/**
|
||||
* Sync the profile.
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function handle(ExternalProfile $profile): ExternalProfile
|
||||
@@ -120,8 +118,6 @@ class SyncExternalProfileAction
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the animes by the external id.
|
||||
*
|
||||
* @return Collection<int, int>
|
||||
*/
|
||||
protected function getAnimesByExternalId(int $externalId): Collection
|
||||
|
||||
@@ -16,9 +16,6 @@ use Illuminate\Support\Facades\Crypt;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Class MalExternalTokenAction.
|
||||
*/
|
||||
class MalExternalTokenAction extends BaseExternalTokenAction
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -13,9 +13,6 @@ use Illuminate\Support\Facades\Log;
|
||||
|
||||
class FixPlaylistAction
|
||||
{
|
||||
/**
|
||||
* Handle the action.
|
||||
*/
|
||||
public function handle(Playlist $playlist, mixed $context = null): int
|
||||
{
|
||||
// Fetch all tracks in the playlist and index them by track_id
|
||||
|
||||
@@ -13,8 +13,6 @@ use Illuminate\Support\Facades\Log;
|
||||
class RemoveTrackAction
|
||||
{
|
||||
/**
|
||||
* Remove track from playlist.
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function remove(Playlist $playlist, PlaylistTrack $track): void
|
||||
|
||||
@@ -28,9 +28,6 @@ class ManageStepAction
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the model according the step.
|
||||
*/
|
||||
protected static function approveCreate(ReportStep $step): void
|
||||
{
|
||||
/** @var Model $model */
|
||||
@@ -41,9 +38,6 @@ class ManageStepAction
|
||||
static::markAsApproved($step);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the model according the step.
|
||||
*/
|
||||
protected static function approveDelete(ReportStep $step): void
|
||||
{
|
||||
$step->actionable->delete();
|
||||
@@ -51,9 +45,6 @@ class ManageStepAction
|
||||
static::markAsApproved($step);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the model according the step.
|
||||
*/
|
||||
protected static function approveUpdate(ReportStep $step): void
|
||||
{
|
||||
$step->actionable->update($step->fields);
|
||||
@@ -61,9 +52,6 @@ class ManageStepAction
|
||||
static::markAsApproved($step);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach a model to another according the step.
|
||||
*/
|
||||
protected static function approveAttach(ReportStep $step): void
|
||||
{
|
||||
/** @var Pivot $pivot */
|
||||
@@ -74,9 +62,6 @@ class ManageStepAction
|
||||
static::markAsApproved($step);
|
||||
}
|
||||
|
||||
/**
|
||||
* Detach a model from another according the step.
|
||||
*/
|
||||
protected static function approveDetach(ReportStep $step): void
|
||||
{
|
||||
/** @var Pivot $pivot */
|
||||
@@ -87,33 +72,21 @@ class ManageStepAction
|
||||
static::markAsApproved($step);
|
||||
}
|
||||
|
||||
/**
|
||||
* Approve the step.
|
||||
*/
|
||||
protected static function markAsApproved(ReportStep $step): void
|
||||
{
|
||||
static::updateStatus($step, ApprovableStatus::APPROVED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reject the step.
|
||||
*/
|
||||
protected static function markAsRejected(ReportStep $step): void
|
||||
{
|
||||
static::updateStatus($step, ApprovableStatus::REJECTED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Approve partially the step.
|
||||
*/
|
||||
protected static function markAsPartiallyApproved(ReportStep $step): void
|
||||
{
|
||||
static::updateStatus($step, ApprovableStatus::PARTIALLY_APPROVED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the status of the step.
|
||||
*/
|
||||
protected static function updateStatus(ReportStep $step, ApprovableStatus $status): void
|
||||
{
|
||||
$step->update([
|
||||
|
||||
@@ -19,9 +19,6 @@ use Illuminate\Support\Facades\Http;
|
||||
|
||||
class AnilistAnimeExternalApiAction extends ExternalApiAction implements BackfillImages, BackfillResources, BackfillSynonyms
|
||||
{
|
||||
/**
|
||||
* Get the site to backfill.
|
||||
*/
|
||||
public function getSite(): ResourceSite
|
||||
{
|
||||
return ResourceSite::ANILIST;
|
||||
|
||||
@@ -15,9 +15,6 @@ use Illuminate\Support\Facades\Http;
|
||||
|
||||
class JikanAnimeExternalApiAction extends ExternalApiAction implements BackfillResources
|
||||
{
|
||||
/**
|
||||
* Get the site to backfill.
|
||||
*/
|
||||
public function getSite(): ResourceSite
|
||||
{
|
||||
return ResourceSite::MAL;
|
||||
|
||||
@@ -14,9 +14,6 @@ use Illuminate\Support\Facades\Http;
|
||||
|
||||
class LivechartAnimeExternalApiAction extends ExternalApiAction implements BackfillResources
|
||||
{
|
||||
/**
|
||||
* Get the site to backfill.
|
||||
*/
|
||||
public function getSite(): ResourceSite
|
||||
{
|
||||
return ResourceSite::LIVECHART;
|
||||
|
||||
@@ -17,9 +17,6 @@ use Illuminate\Support\Facades\Http;
|
||||
|
||||
class MalAnimeExternalApiAction extends ExternalApiAction implements BackfillStudios
|
||||
{
|
||||
/**
|
||||
* Get the site to backfill.
|
||||
*/
|
||||
public function getSite(): ResourceSite
|
||||
{
|
||||
return ResourceSite::MAL;
|
||||
|
||||
@@ -15,8 +15,6 @@ class AttachImageAction
|
||||
use CanCreateImage;
|
||||
|
||||
/**
|
||||
* Perform the action on the given models.
|
||||
*
|
||||
* @param array $fields
|
||||
* @param ImageFacet[] $facets
|
||||
*/
|
||||
|
||||
@@ -15,8 +15,6 @@ class AttachResourceAction
|
||||
use CanCreateExternalResource;
|
||||
|
||||
/**
|
||||
* Handle the action.
|
||||
*
|
||||
* @param array $fields
|
||||
* @param ResourceSite[] $sites
|
||||
*/
|
||||
|
||||
@@ -40,9 +40,6 @@ class BackfillAnimeAction extends BackfillWikiAction
|
||||
parent::__construct($anime, $toBackfill);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the action.
|
||||
*/
|
||||
public function handle(): ActionResult
|
||||
{
|
||||
try {
|
||||
@@ -165,9 +162,6 @@ class BackfillAnimeAction extends BackfillWikiAction
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the model for the action.
|
||||
*/
|
||||
protected function getModel(): Anime
|
||||
{
|
||||
return $this->anime;
|
||||
|
||||
@@ -18,8 +18,6 @@ use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Uri;
|
||||
|
||||
/**
|
||||
* Class BackfillVideoAudioAction.
|
||||
*
|
||||
* @extends BackfillAction<Song>
|
||||
*/
|
||||
class BackfillSongAction extends BackfillAction
|
||||
@@ -34,8 +32,6 @@ class BackfillSongAction extends BackfillAction
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle action.
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function handle(): ActionResult
|
||||
|
||||
@@ -24,9 +24,6 @@ class BackfillStudioAction extends BackfillWikiAction
|
||||
parent::__construct($studio, $toBackfill);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the action.
|
||||
*/
|
||||
public function handle(): ActionResult
|
||||
{
|
||||
foreach ($this->getExternalApiActions() as $api) {
|
||||
@@ -72,9 +69,6 @@ class BackfillStudioAction extends BackfillWikiAction
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the model for the action.
|
||||
*/
|
||||
protected function getModel(): Studio
|
||||
{
|
||||
return $this->studio;
|
||||
|
||||
@@ -14,15 +14,10 @@ use Illuminate\Support\Arr;
|
||||
abstract class ExternalApiAction
|
||||
{
|
||||
/**
|
||||
* The response of the request.
|
||||
*
|
||||
* @var array|null
|
||||
*/
|
||||
public ?array $response = null;
|
||||
|
||||
/**
|
||||
* Get the site to backfill.
|
||||
*/
|
||||
abstract public function getSite(): ResourceSite;
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,9 +21,6 @@ class ManageSongPerformances
|
||||
protected array $groups = [];
|
||||
protected array $performances = [];
|
||||
|
||||
/**
|
||||
* Add the song of the performances.
|
||||
*/
|
||||
public function forSong(Song|int $song): static
|
||||
{
|
||||
$this->song = $song instanceof Song ? $song->getKey() : $song;
|
||||
@@ -31,9 +28,6 @@ class ManageSongPerformances
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a single artist to the song performance.
|
||||
*/
|
||||
public function addSingleArtist(int $artist, ?string $alias = null, ?string $as = null): static
|
||||
{
|
||||
$this->performances[] = [
|
||||
@@ -46,9 +40,6 @@ class ManageSongPerformances
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a group data to the performance.
|
||||
*/
|
||||
public function addGroupData(int $group, ?string $alias = null, ?string $as = null): static
|
||||
{
|
||||
$this->groups[$group] = [
|
||||
@@ -59,9 +50,6 @@ class ManageSongPerformances
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a membership to the song.
|
||||
*/
|
||||
public function addMembership(int $group, int $member, ?string $alias = null, ?string $as = null): static
|
||||
{
|
||||
$this->performances[] = [
|
||||
@@ -79,9 +67,6 @@ class ManageSongPerformances
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Commit the performances to the song.
|
||||
*/
|
||||
public function commit(): static
|
||||
{
|
||||
try {
|
||||
|
||||
@@ -14,9 +14,6 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
class MalStudioExternalApiAction extends ExternalApiAction implements BackfillImages
|
||||
{
|
||||
/**
|
||||
* Get the site to backfill.
|
||||
*/
|
||||
public function getSite(): ResourceSite
|
||||
{
|
||||
return ResourceSite::MAL;
|
||||
|
||||
@@ -33,8 +33,6 @@ use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* Class BackfillVideoAudioAction.
|
||||
*
|
||||
* @extends BackfillAction<Video>
|
||||
*/
|
||||
class BackfillAudioAction extends BackfillAction
|
||||
@@ -49,8 +47,6 @@ class BackfillAudioAction extends BackfillAction
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle action.
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function handle(): ActionResult
|
||||
@@ -108,25 +104,16 @@ class BackfillAudioAction extends BackfillAction
|
||||
return $this->getModel()->audio();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the source video should be derived.
|
||||
*/
|
||||
protected function deriveSourceVideo(): bool
|
||||
{
|
||||
return $this->deriveSourceVideo === DeriveSourceVideo::YES;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if audio should be overwritten.
|
||||
*/
|
||||
protected function overwriteAudio(): bool
|
||||
{
|
||||
return $this->overwriteAudio === OverwriteAudio::YES;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the new audio should replace a related one.
|
||||
*/
|
||||
protected function replaceRelatedAudio(): bool
|
||||
{
|
||||
return $this->replaceRelatedAudio === ReplaceRelatedAudio::YES;
|
||||
@@ -190,9 +177,6 @@ class BackfillAudioAction extends BackfillAction
|
||||
return $audio;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the source video for the given video.
|
||||
*/
|
||||
protected function getSourceVideo(string $operation = '>'): ?Video
|
||||
{
|
||||
$source = null;
|
||||
@@ -213,8 +197,6 @@ class BackfillAudioAction extends BackfillAction
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the adjacent videos for sourcing.
|
||||
*
|
||||
* @return Collection<int, Video>
|
||||
*/
|
||||
protected function getAdjacentVideos(): Collection
|
||||
@@ -290,9 +272,6 @@ class BackfillAudioAction extends BackfillAction
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach Audio to model.
|
||||
*/
|
||||
protected function attachAudio(Audio $audio): void
|
||||
{
|
||||
if ($this->relation()->isNot($audio)) {
|
||||
|
||||
@@ -12,8 +12,6 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
* Class ReconcileDumpRepositories.
|
||||
*
|
||||
* @extends ReconcileRepositoriesAction<Dump>
|
||||
*/
|
||||
class ReconcileDumpRepositoriesAction extends ReconcileRepositoriesAction
|
||||
|
||||
@@ -8,8 +8,6 @@ use App\Actions\Repositories\ReconcileResults;
|
||||
use App\Models\Admin\Dump;
|
||||
|
||||
/**
|
||||
* Class ReconcileDumpResults.
|
||||
*
|
||||
* @extends ReconcileResults<Dump>
|
||||
*/
|
||||
class ReconcileDumpResults extends ReconcileResults
|
||||
|
||||
@@ -13,8 +13,6 @@ use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Class ReconcileRepositories.
|
||||
*
|
||||
* @template TModel of \App\Models\BaseModel
|
||||
*/
|
||||
abstract class ReconcileRepositoriesAction
|
||||
|
||||
@@ -14,8 +14,6 @@ use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* Class ReconcileResults.
|
||||
*
|
||||
* @template TModel of \App\Models\BaseModel
|
||||
*/
|
||||
abstract class ReconcileResults extends ActionResult
|
||||
|
||||
@@ -12,8 +12,6 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
* Class ReconcileAudioRepositories.
|
||||
*
|
||||
* @extends ReconcileRepositoriesAction<Audio>
|
||||
*/
|
||||
class ReconcileAudioRepositoriesAction extends ReconcileRepositoriesAction
|
||||
|
||||
@@ -8,8 +8,6 @@ use App\Actions\Repositories\ReconcileResults;
|
||||
use App\Models\Wiki\Audio;
|
||||
|
||||
/**
|
||||
* Class ReconcileAudioResults.
|
||||
*
|
||||
* @extends ReconcileResults<Audio>
|
||||
*/
|
||||
class ReconcileAudioResults extends ReconcileResults
|
||||
|
||||
@@ -12,8 +12,6 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
* Class ReconcileVideoRepositories.
|
||||
*
|
||||
* @extends ReconcileRepositoriesAction<Video>
|
||||
*/
|
||||
class ReconcileVideoRepositoriesAction extends ReconcileRepositoriesAction
|
||||
|
||||
@@ -8,8 +8,6 @@ use App\Actions\Repositories\ReconcileResults;
|
||||
use App\Models\Wiki\Video;
|
||||
|
||||
/**
|
||||
* Class ReconcileVideoResults.
|
||||
*
|
||||
* @extends ReconcileResults<Video>
|
||||
*/
|
||||
class ReconcileVideoResults extends ReconcileResults
|
||||
|
||||
@@ -12,8 +12,6 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
* Class ReconcileScriptRepositoriesAction.
|
||||
*
|
||||
* @extends ReconcileRepositoriesAction<VideoScript>
|
||||
*/
|
||||
class ReconcileScriptRepositoriesAction extends ReconcileRepositoriesAction
|
||||
|
||||
@@ -8,8 +8,6 @@ use App\Actions\Repositories\ReconcileResults;
|
||||
use App\Models\Wiki\Video\VideoScript;
|
||||
|
||||
/**
|
||||
* Class ReconcileScriptResults.
|
||||
*
|
||||
* @extends ReconcileResults<VideoScript>
|
||||
*/
|
||||
class ReconcileScriptResults extends ReconcileResults
|
||||
|
||||
@@ -35,8 +35,6 @@ abstract class DumpAction
|
||||
public function __construct(protected readonly array $options = []) {}
|
||||
|
||||
/**
|
||||
* Handle action.
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function handle(): ActionResult
|
||||
|
||||
@@ -17,17 +17,11 @@ class PruneDumpAction extends PruneAction
|
||||
{
|
||||
use ReconcilesDumpRepositories;
|
||||
|
||||
/**
|
||||
* The name of the disk.
|
||||
*/
|
||||
public function disk(): string
|
||||
{
|
||||
return Config::get(DumpConstants::DISK_QUALIFIED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the file should be pruned.
|
||||
*/
|
||||
protected function shouldBePruned(string $path, Carbon $lastModified): bool
|
||||
{
|
||||
if (Str::contains($path, Dump::safeDumps())) {
|
||||
|
||||
@@ -12,8 +12,6 @@ use Illuminate\Filesystem\FilesystemAdapter;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
/**
|
||||
* Class DeleteAction.
|
||||
*
|
||||
* @template TModel of \App\Models\BaseModel
|
||||
*/
|
||||
abstract class DeleteAction implements InteractsWithDisks, StorageAction
|
||||
@@ -23,9 +21,6 @@ abstract class DeleteAction implements InteractsWithDisks, StorageAction
|
||||
*/
|
||||
public function __construct(protected BaseModel $model) {}
|
||||
|
||||
/**
|
||||
* Handle action.
|
||||
*/
|
||||
public function handle(): StorageResults
|
||||
{
|
||||
$results = [];
|
||||
|
||||
@@ -19,9 +19,6 @@ readonly class DeleteResults implements StorageResults
|
||||
*/
|
||||
public function __construct(protected BaseModel $model, protected array $deletions = []) {}
|
||||
|
||||
/**
|
||||
* Write results to log.
|
||||
*/
|
||||
public function toLog(): void
|
||||
{
|
||||
if (empty($this->deletions)) {
|
||||
@@ -34,9 +31,6 @@ readonly class DeleteResults implements StorageResults
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write results to console output.
|
||||
*/
|
||||
public function toConsole(Command $command): void
|
||||
{
|
||||
if (empty($this->deletions)) {
|
||||
@@ -49,9 +43,6 @@ readonly class DeleteResults implements StorageResults
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform to Action Result.
|
||||
*/
|
||||
public function toActionResult(): ActionResult
|
||||
{
|
||||
if (empty($this->deletions)) {
|
||||
|
||||
@@ -12,8 +12,6 @@ use Illuminate\Filesystem\FilesystemAdapter;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
/**
|
||||
* Class MoveAction.
|
||||
*
|
||||
* @template TModel of \App\Models\BaseModel
|
||||
*/
|
||||
abstract class MoveAction implements InteractsWithDisks, StorageAction
|
||||
@@ -23,9 +21,6 @@ abstract class MoveAction implements InteractsWithDisks, StorageAction
|
||||
*/
|
||||
public function __construct(protected BaseModel $model, protected readonly string $to) {}
|
||||
|
||||
/**
|
||||
* Handle action.
|
||||
*/
|
||||
public function handle(): StorageResults
|
||||
{
|
||||
$results = [];
|
||||
|
||||
@@ -24,9 +24,6 @@ readonly class MoveResults implements StorageResults
|
||||
protected array $moves = []
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Write results to log.
|
||||
*/
|
||||
public function toLog(): void
|
||||
{
|
||||
if (empty($this->moves)) {
|
||||
@@ -39,9 +36,6 @@ readonly class MoveResults implements StorageResults
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write results to console output.
|
||||
*/
|
||||
public function toConsole(Command $command): void
|
||||
{
|
||||
if (empty($this->moves)) {
|
||||
@@ -54,9 +48,6 @@ readonly class MoveResults implements StorageResults
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform to Action Result.
|
||||
*/
|
||||
public function toActionResult(): ActionResult
|
||||
{
|
||||
if (empty($this->moves)) {
|
||||
|
||||
@@ -19,9 +19,6 @@ abstract class PruneAction implements InteractsWithDisk, StorageAction
|
||||
|
||||
public function __construct(protected readonly int $hours = 72) {}
|
||||
|
||||
/**
|
||||
* Handle action.
|
||||
*/
|
||||
public function handle(): StorageResults
|
||||
{
|
||||
$fs = Storage::disk($this->disk());
|
||||
|
||||
@@ -18,9 +18,6 @@ readonly class PruneResults implements StorageResults
|
||||
*/
|
||||
public function __construct(protected string $fs, protected array $prunings = []) {}
|
||||
|
||||
/**
|
||||
* Write results to log.
|
||||
*/
|
||||
public function toLog(): void
|
||||
{
|
||||
if (empty($this->prunings)) {
|
||||
@@ -33,9 +30,6 @@ readonly class PruneResults implements StorageResults
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write results to console output.
|
||||
*/
|
||||
public function toConsole(Command $command): void
|
||||
{
|
||||
if (empty($this->prunings)) {
|
||||
@@ -48,9 +42,6 @@ readonly class PruneResults implements StorageResults
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform to Action Result.
|
||||
*/
|
||||
public function toActionResult(): ActionResult
|
||||
{
|
||||
if (empty($this->prunings)) {
|
||||
|
||||
@@ -15,9 +15,6 @@ abstract class UploadAction implements InteractsWithDisks, StorageAction
|
||||
{
|
||||
public function __construct(protected readonly UploadedFile $file, protected readonly string $path) {}
|
||||
|
||||
/**
|
||||
* Handle action.
|
||||
*/
|
||||
public function handle(): StorageResults
|
||||
{
|
||||
$results = [];
|
||||
|
||||
@@ -18,9 +18,6 @@ readonly class UploadResults implements StorageResults
|
||||
*/
|
||||
public function __construct(protected array $uploads = []) {}
|
||||
|
||||
/**
|
||||
* Write results to log.
|
||||
*/
|
||||
public function toLog(): void
|
||||
{
|
||||
if (empty($this->uploads)) {
|
||||
@@ -33,9 +30,6 @@ readonly class UploadResults implements StorageResults
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write results to console output.
|
||||
*/
|
||||
public function toConsole(Command $command): void
|
||||
{
|
||||
if (empty($this->uploads)) {
|
||||
@@ -48,9 +42,6 @@ readonly class UploadResults implements StorageResults
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform to Action Result.
|
||||
*/
|
||||
public function toActionResult(): ActionResult
|
||||
{
|
||||
if (empty($this->uploads)) {
|
||||
|
||||
@@ -10,8 +10,6 @@ use App\Models\Wiki\Audio;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
|
||||
/**
|
||||
* Class DeleteAudioAction.
|
||||
*
|
||||
* @extends DeleteAction<Audio>
|
||||
*/
|
||||
class DeleteAudioAction extends DeleteAction
|
||||
|
||||
@@ -11,8 +11,6 @@ use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
/**
|
||||
* Class MoveAudioAction.
|
||||
*
|
||||
* @extends MoveAction<Audio>
|
||||
*/
|
||||
class MoveAudioAction extends MoveAction
|
||||
|
||||
@@ -11,8 +11,6 @@ use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
|
||||
/**
|
||||
* Class MoveImageAction.
|
||||
*
|
||||
* @extends MoveAction<Image>
|
||||
*/
|
||||
class MoveImageAction extends MoveAction
|
||||
|
||||
@@ -10,8 +10,6 @@ use App\Models\Wiki\Video;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
|
||||
/**
|
||||
* Class DeleteVideoAction.
|
||||
*
|
||||
* @extends DeleteAction<Video>
|
||||
*/
|
||||
class DeleteVideoAction extends DeleteAction
|
||||
|
||||
@@ -11,8 +11,6 @@ use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
/**
|
||||
* Class MoveVideoAction.
|
||||
*
|
||||
* @extends MoveAction<Video>
|
||||
*/
|
||||
class MoveVideoAction extends MoveAction
|
||||
|
||||
@@ -11,8 +11,6 @@ use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
|
||||
/**
|
||||
* Class DeleteScriptAction.
|
||||
*
|
||||
* @extends DeleteAction<VideoScript>
|
||||
*/
|
||||
class DeleteScriptAction extends DeleteAction
|
||||
|
||||
@@ -11,8 +11,6 @@ use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
|
||||
/**
|
||||
* Class MoveVideoAction.
|
||||
*
|
||||
* @extends MoveAction<VideoScript>
|
||||
*/
|
||||
class MoveScriptAction extends MoveAction
|
||||
|
||||
@@ -10,8 +10,6 @@ use Illuminate\Support\Arr;
|
||||
trait SearchModels
|
||||
{
|
||||
/**
|
||||
* Search models.
|
||||
*
|
||||
* @param array<string, mixed> $args
|
||||
*/
|
||||
public function search(Builder $builder, array $args): Builder
|
||||
|
||||
@@ -18,9 +18,6 @@ use InvalidArgumentException;
|
||||
|
||||
trait SortsModels
|
||||
{
|
||||
/**
|
||||
* Apply sorts to the query builder.
|
||||
*/
|
||||
public function sort(Builder $builder, array $args, BaseType|BaseUnion $type): Builder
|
||||
{
|
||||
$sorts = Arr::get($args, SortArgument::ARGUMENT);
|
||||
|
||||
@@ -13,9 +13,6 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
trait AggregatesFields
|
||||
{
|
||||
/**
|
||||
* Select aggregate fields for the query builder.
|
||||
*/
|
||||
public function withAggregates(Builder $builder, Query $query, Schema $schema): Builder
|
||||
{
|
||||
collect($schema->fields())
|
||||
@@ -25,9 +22,6 @@ trait AggregatesFields
|
||||
return $builder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load aggregate fields for the model.
|
||||
*/
|
||||
public function loadAggregates(Model $model, Query $query, Schema $schema): Model
|
||||
{
|
||||
collect($schema->fields())
|
||||
|
||||
@@ -11,9 +11,6 @@ use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
trait FiltersModels
|
||||
{
|
||||
/**
|
||||
* Apply filters to the query builder.
|
||||
*/
|
||||
public function filter(Builder $builder, Query $query, Schema $schema, Scope $scope): Builder
|
||||
{
|
||||
foreach ($query->getFilterCriteria() as $criteria) {
|
||||
|
||||
@@ -12,9 +12,6 @@ use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
trait SelectsFields
|
||||
{
|
||||
/**
|
||||
* Selects fields for the query builder.
|
||||
*/
|
||||
public function select(Builder $builder, Query $query, Schema $schema): Builder
|
||||
{
|
||||
$selectedFields = collect($schema->fields())
|
||||
|
||||
@@ -12,9 +12,6 @@ use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
trait SortsModels
|
||||
{
|
||||
/**
|
||||
* Apply sorts to the query builder.
|
||||
*/
|
||||
public function sort(Builder $builder, Query $query, Schema $schema, Scope $scope = new GlobalScope()): Builder
|
||||
{
|
||||
foreach ($query->getSortCriteria() as $sortCriterion) {
|
||||
|
||||
@@ -6,9 +6,6 @@ namespace App\Concerns;
|
||||
|
||||
trait DetectsRedis
|
||||
{
|
||||
/**
|
||||
* Determine if the application uses any Redis services.
|
||||
*/
|
||||
protected function appUsesRedis(): bool
|
||||
{
|
||||
// We assume here that if the cache, session, broadcasting or queue is powered by Redis,
|
||||
|
||||
@@ -25,8 +25,6 @@ trait HasAttributeUpdateEmbedFields
|
||||
}
|
||||
|
||||
/**
|
||||
* Get changed attributes.
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
protected function getChangedAttributes(Model $model): Collection
|
||||
@@ -37,9 +35,6 @@ trait HasAttributeUpdateEmbedFields
|
||||
->keys();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get model attribute value.
|
||||
*/
|
||||
protected function getAttributeValue(Model $model, mixed $attribute): mixed
|
||||
{
|
||||
// Hide field from embed by obscuring the values
|
||||
@@ -51,8 +46,6 @@ trait HasAttributeUpdateEmbedFields
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Embed Fields.
|
||||
*
|
||||
* @param Collection $changedAttributes
|
||||
*/
|
||||
protected function addEmbedFields(Model $original, Model $changed, Collection $changedAttributes): void
|
||||
|
||||
@@ -9,23 +9,16 @@ use App\Discord\DiscordEmbedField;
|
||||
trait HasDiscordEmbedFields
|
||||
{
|
||||
/**
|
||||
* The array of embed fields.
|
||||
*
|
||||
* @var DiscordEmbedField[]
|
||||
*/
|
||||
protected array $embedFields = [];
|
||||
|
||||
/**
|
||||
* Add discord embed field.
|
||||
*/
|
||||
protected function addEmbedField(DiscordEmbedField $embedField): void
|
||||
{
|
||||
$this->embedFields[] = $embedField;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get discord embed fields.
|
||||
*
|
||||
* @return DiscordEmbedField[]
|
||||
*/
|
||||
protected function getEmbedFields(): array
|
||||
|
||||
@@ -10,8 +10,6 @@ use Illuminate\Support\Str;
|
||||
trait FormatsPermission
|
||||
{
|
||||
/**
|
||||
* Format permission name for model.
|
||||
*
|
||||
* @param class-string<Model> $modelClass
|
||||
*/
|
||||
public function format(string $modelClass): string
|
||||
|
||||
@@ -10,9 +10,6 @@ use Illuminate\Support\Str;
|
||||
|
||||
trait LocalizesName
|
||||
{
|
||||
/**
|
||||
* Localize the enum.
|
||||
*/
|
||||
public function localize(?string $locale = null): ?string
|
||||
{
|
||||
return $this->getLocalizedName($locale)
|
||||
@@ -41,9 +38,6 @@ trait LocalizesName
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a pretty-printed version of the enum value.
|
||||
*/
|
||||
protected function getPrettyName(): string
|
||||
{
|
||||
return Str::of($this->name)
|
||||
@@ -52,9 +46,6 @@ trait LocalizesName
|
||||
->__toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default localization key.
|
||||
*/
|
||||
protected function getLocalizationKey(): string
|
||||
{
|
||||
return Str::of('enums.')
|
||||
@@ -81,9 +72,6 @@ trait LocalizesName
|
||||
return $selectArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a new instance from the localized name.
|
||||
*/
|
||||
public static function fromLocalizedName(string $localizedName, ?string $locale = null): ?static
|
||||
{
|
||||
return Arr::first(
|
||||
|
||||
@@ -19,9 +19,6 @@ trait HasActionLogs
|
||||
protected ?Model $parentRecordLog = null;
|
||||
protected ?Model $pivot = null;
|
||||
|
||||
/**
|
||||
* Create a batch id for the action.
|
||||
*/
|
||||
public function createBatchId(): string
|
||||
{
|
||||
$this->batchId = Str::orderedUuid()->__toString();
|
||||
@@ -29,9 +26,6 @@ trait HasActionLogs
|
||||
return $this->batchId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an action log.
|
||||
*/
|
||||
public function createActionLog(Action $action, Model $record, ?bool $shouldCreateNewBatchId = true): void
|
||||
{
|
||||
if ($shouldCreateNewBatchId) {
|
||||
@@ -49,9 +43,6 @@ trait HasActionLogs
|
||||
$this->actionLog = $actionLog;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the log for pivot actions.
|
||||
*/
|
||||
public function updateLog(Model $relatedModel, Model $pivot): void
|
||||
{
|
||||
$this->actionLog->update([
|
||||
@@ -62,9 +53,6 @@ trait HasActionLogs
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark the action as failed.
|
||||
*/
|
||||
public function failedLog(Throwable|string|null $exception): void
|
||||
{
|
||||
$this->actionLog->failed($exception);
|
||||
@@ -76,9 +64,6 @@ trait HasActionLogs
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark the action as finished if not failed.
|
||||
*/
|
||||
public function finishedLog(): void
|
||||
{
|
||||
if ($actionLog = $this->actionLog) {
|
||||
@@ -93,17 +78,11 @@ trait HasActionLogs
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark batch action as finished where not failed.
|
||||
*/
|
||||
public function batchFinishedLog(): void
|
||||
{
|
||||
$this->actionLog->batchFinished();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the action is failed.
|
||||
*/
|
||||
public function isFailedLog(): bool
|
||||
{
|
||||
return $this->actionLog->isFailed();
|
||||
|
||||
@@ -13,9 +13,6 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
trait HasPivotActionLogs
|
||||
{
|
||||
/**
|
||||
* Create the pivot action log.
|
||||
*/
|
||||
public function pivotActionLog(string $actionName, BaseRelationManager $livewire, Model $record, ?Action $action = null): void
|
||||
{
|
||||
$ownerRecord = $livewire->getOwnerRecord();
|
||||
@@ -40,9 +37,6 @@ trait HasPivotActionLogs
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the associate action log.
|
||||
*/
|
||||
public function associateActionLog(string $actionName, BaseRelationManager $livewire, Model $record, Action $action): void
|
||||
{
|
||||
$ownerRecord = $livewire->getOwnerRecord();
|
||||
|
||||
@@ -10,8 +10,6 @@ use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
trait ModelHasActionLogs
|
||||
{
|
||||
/**
|
||||
* Get the action logs for the model.
|
||||
*
|
||||
* @return MorphMany
|
||||
*/
|
||||
public function actionlogs(): MorphMany
|
||||
|
||||
@@ -105,8 +105,6 @@ trait ResolvesArguments
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the bind arguments.
|
||||
*
|
||||
* @param Field[] $fields
|
||||
* @return BindableArgument[]
|
||||
*/
|
||||
|
||||
@@ -12,8 +12,6 @@ trait AggregatesLike
|
||||
final public const RELATION_LIKE_AGGREGATE = 'likeAggregate';
|
||||
|
||||
/**
|
||||
* Get the likes count of the model.
|
||||
*
|
||||
* @return MorphOne<LikeAggregate, $this>
|
||||
*/
|
||||
public function likeAggregate(): MorphOne
|
||||
|
||||
@@ -12,8 +12,6 @@ trait AggregatesView
|
||||
final public const RELATION_VIEW_AGGREGATE = 'viewAggregate';
|
||||
|
||||
/**
|
||||
* Get the views count of the model.
|
||||
*
|
||||
* @return MorphOne<ViewAggregate, $this>
|
||||
*/
|
||||
public function viewAggregate(): MorphOne
|
||||
|
||||
@@ -12,9 +12,6 @@ use Illuminate\Support\Str;
|
||||
|
||||
trait CanCreateAnimeSynonym
|
||||
{
|
||||
/**
|
||||
* Create Anime Synonym for the Anime.
|
||||
*/
|
||||
public function createAnimeSynonym(?string $text, int $type, Anime $anime): void
|
||||
{
|
||||
if (
|
||||
|
||||
@@ -16,9 +16,6 @@ trait CanCreateExternalResource
|
||||
{
|
||||
use HasLabel;
|
||||
|
||||
/**
|
||||
* Get or Create Resource from response.
|
||||
*/
|
||||
public function createResource(Uri $uri, ResourceSite $site, (BaseModel&HasResources)|null $model = null): ExternalResource
|
||||
{
|
||||
$url = $uri->withScheme('https')->__toString();
|
||||
@@ -61,9 +58,6 @@ trait CanCreateExternalResource
|
||||
return $resource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try attach the resource.
|
||||
*/
|
||||
protected function attachResource(ExternalResource $resource, (BaseModel&HasResources)|null $model): void
|
||||
{
|
||||
if ($model !== null) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user