diff --git a/app/Http/Controllers/Staff/ReportAssigneeController.php b/app/Http/Controllers/Staff/ReportAssigneeController.php index dcb8cefc0..07df25998 100644 --- a/app/Http/Controllers/Staff/ReportAssigneeController.php +++ b/app/Http/Controllers/Staff/ReportAssigneeController.php @@ -29,7 +29,7 @@ class ReportAssigneeController extends Controller { $report->update($request->validated()); - $assignedStaff = User::findOrFail($request->integer('staff_id')); + $assignedStaff = User::findOrFail($request->integer('assigned_to')); $assignedStaff->notify(new NewReportAssigned($report)); diff --git a/app/Http/Livewire/ReportSearch.php b/app/Http/Livewire/ReportSearch.php index 8d1d906ea..9c36ceac9 100644 --- a/app/Http/Livewire/ReportSearch.php +++ b/app/Http/Livewire/ReportSearch.php @@ -70,7 +70,7 @@ class ReportSearch extends Component */ final protected \Illuminate\Pagination\LengthAwarePaginator $reports { get => Report::query() - ->with('reported.group', 'reporter.group', 'staff.group') + ->with('reported.group', 'reporter.group', 'assignee.group') ->when($this->type !== null, fn ($query) => $query->where('type', '=', $this->type)) ->when($this->reporter !== null, fn ($query) => $query->whereRelation('reporter', 'username', 'LIKE', '%'.$this->reporter.'%')) ->when($this->reported !== null, fn ($query) => $query->whereRelation('reported', 'username', 'LIKE', '%'.$this->reported.'%')) diff --git a/app/Models/Report.php b/app/Models/Report.php index 6562a4e18..ab61c6b80 100644 --- a/app/Models/Report.php +++ b/app/Models/Report.php @@ -28,7 +28,9 @@ use AllowDynamicProperties; * @property int $id * @property string $type * @property int $reporter_id - * @property int|null $staff_id + * @property int $reported_user_id + * @property int $reported_torrent_id + * @property int $reported_request_id * @property string $title * @property string $message * @property int|null $solved_by @@ -59,13 +61,13 @@ final class Report extends Model /** * Get the attributes that should be cast. * - * @return array{snoozed_until: 'datetime', closed_at: 'datetime'} + * @return array{snoozed_until: 'datetime', solved_at: 'datetime'} */ protected function casts(): array { return [ 'snoozed_until' => 'datetime', - 'closed_at' => 'datetime', + 'solved_at' => 'datetime', ]; } diff --git a/database/factories/ReportFactory.php b/database/factories/ReportFactory.php index a8a6f2c55..90d69e5de 100644 --- a/database/factories/ReportFactory.php +++ b/database/factories/ReportFactory.php @@ -43,7 +43,7 @@ class ReportFactory extends Factory 'reported_torrent_id' => Torrent::factory(), 'reported_request_id' => TorrentRequest::factory(), 'message' => $this->faker->text(), - 'staff_id' => User::factory(), + 'assigned_to' => User::factory(), 'verdict' => $this->faker->text(), 'created_at' => $this->faker->dateTime(), 'updated_at' => $this->faker->optional()->dateTime(), diff --git a/resources/views/Staff/report/show.blade.php b/resources/views/Staff/report/show.blade.php index 915473855..b530c962e 100644 --- a/resources/views/Staff/report/show.blade.php +++ b/resources/views/Staff/report/show.blade.php @@ -157,8 +157,8 @@ @csrf
-
diff --git a/tests/Feature/Http/Controllers/Staff/ReportAssigneeControllerTest.php b/tests/Feature/Http/Controllers/Staff/ReportAssigneeControllerTest.php index 5b210729a..321c936eb 100644 --- a/tests/Feature/Http/Controllers/Staff/ReportAssigneeControllerTest.php +++ b/tests/Feature/Http/Controllers/Staff/ReportAssigneeControllerTest.php @@ -34,14 +34,14 @@ test('assign a staff member to a report returns an ok response', function (): vo ]); $response = $this->actingAs($staff1)->post(route('staff.reports.assignee.store', [$report]), [ - 'staff_id' => $staff2->id, + 'assigned_to' => $staff2->id, ]); $response->assertRedirect(route('staff.reports.show', $report)); $this->assertDatabaseHas('reports', [ - 'id' => $report->id, - 'staff_id' => $staff2->id, + 'id' => $report->id, + 'assigned_to' => $staff2->id, ]); Notification::assertSentTo(