Skip to content

Commit

Permalink
Use loadExists() on StoreTorrentRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
Obi-Wana committed Feb 1, 2025
1 parent 36528d3 commit 9f30078
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions app/Http/Requests/StoreTorrentRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function authorize(): bool
*/
public function rules(Request $request): array
{
$user = $request->user();
$user = $request->user()->loadExists('internals');
$category = Category::findOrFail($request->integer('category_id'));

return [
Expand Down Expand Up @@ -224,19 +224,22 @@ function (string $attribute, mixed $value, Closure $fail): void {
'internal' => [
'sometimes',
'boolean',
Rule::when(!$user->group->is_modo && !$user->internals()->exists(), 'prohibited'),
/** @phpstan-ignore property.notFound (Larastan doesn't yet support loadExists()) */

Check warning on line 227 in app/Http/Requests/StoreTorrentRequest.php

View workflow job for this annotation

GitHub Actions / ubuntu-22.04

Unknown word (Larastan)
Rule::when(!$user->group->is_modo && !$user->internals_exists, 'prohibited'),
],
'free' => [
'sometimes',
'integer',
'numeric',
'between:0,100',
Rule::when(!$user->group->is_modo && !$user->internals()->exists(), 'prohibited'),
/** @phpstan-ignore property.notFound (Larastan doesn't yet support loadExists()) */

Check warning on line 235 in app/Http/Requests/StoreTorrentRequest.php

View workflow job for this annotation

GitHub Actions / ubuntu-22.04

Unknown word (Larastan)
Rule::when(!$user->group->is_modo && !$user->internals_exists, 'prohibited'),
],
'refundable' => [
'sometimes',
'boolean',
Rule::when(!$user->group->is_modo && !$user->internals()->exists(), 'prohibited'),
/** @phpstan-ignore property.notFound (Larastan doesn't yet support loadExists()) */

Check warning on line 241 in app/Http/Requests/StoreTorrentRequest.php

View workflow job for this annotation

GitHub Actions / ubuntu-22.04

Unknown word (Larastan)
Rule::when(!$user->group->is_modo && !$user->internals_exists, 'prohibited'),
],
];
}
Expand Down

0 comments on commit 9f30078

Please sign in to comment.