Files
usher-manage-stack/database/factories/DocumentFactory.php
Gbanyan 642b879dd4 Add membership fee system with disability discount and fix document permissions
Features:
- Implement two fee types: entrance fee and annual fee (both NT$1,000)
- Add 50% discount for disability certificate holders
- Add disability certificate upload in member profile
- Integrate disability verification into cashier approval workflow
- Add membership fee settings in system admin

Document permissions:
- Fix hard-coded role logic in Document model
- Use permission-based authorization instead of role checks

Additional features:
- Add announcements, general ledger, and trial balance modules
- Add income management and accounting entries
- Add comprehensive test suite with factories
- Update UI translations to Traditional Chinese

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 09:56:01 +08:00

32 lines
1.0 KiB
PHP

<?php
namespace Database\Factories;
use App\Models\Document;
use App\Models\DocumentCategory;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
class DocumentFactory extends Factory
{
protected $model = Document::class;
public function definition(): array
{
return [
'document_category_id' => DocumentCategory::factory(),
'title' => $this->faker->sentence(3),
'document_number' => 'DOC-'.now()->format('Y').'-'.str_pad(rand(1, 9999), 4, '0', STR_PAD_LEFT),
'description' => $this->faker->paragraph(),
'public_uuid' => (string) Str::uuid(),
'access_level' => $this->faker->randomElement(['public', 'members', 'admin']),
'status' => 'active',
'created_by_user_id' => User::factory(),
'view_count' => $this->faker->numberBetween(0, 100),
'download_count' => $this->faker->numberBetween(0, 50),
'version_count' => 1,
];
}
}