mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-28 17:01:16 +00:00
Add reported releases widget to dashboard
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Release;
|
||||
use App\Models\ReleaseReport;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\ReleaseReport>
|
||||
*/
|
||||
class ReleaseReportFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var class-string<\App\Models\ReleaseReport>
|
||||
*/
|
||||
protected $model = ReleaseReport::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
$reasons = array_keys(ReleaseReport::REASONS);
|
||||
|
||||
return [
|
||||
'releases_id' => Release::factory(),
|
||||
'users_id' => User::factory(),
|
||||
'reason' => fake()->randomElement($reasons),
|
||||
'description' => fake()->optional()->sentence(),
|
||||
'status' => 'pending',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the report is pending.
|
||||
*/
|
||||
public function pending(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'status' => 'pending',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the report has been reviewed.
|
||||
*/
|
||||
public function reviewed(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'status' => 'reviewed',
|
||||
'reviewed_by' => User::factory(),
|
||||
'reviewed_at' => now(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the report has been resolved.
|
||||
*/
|
||||
public function resolved(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'status' => 'resolved',
|
||||
'reviewed_by' => User::factory(),
|
||||
'reviewed_at' => now(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the report has been dismissed.
|
||||
*/
|
||||
public function dismissed(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'status' => 'dismissed',
|
||||
'reviewed_by' => User::factory(),
|
||||
'reviewed_at' => now(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user