Add polymorphic type references system for efficient integer-based storage

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-12-27 23:10:30 +00:00
parent c1485ccbdb
commit 4db772b132
14 changed files with 1071 additions and 87 deletions

View File

@@ -1054,6 +1054,25 @@ Details: `php artisan rsx:man file_upload`
---
## POLYMORPHIC TYPE REFERENCES
Polymorphic `*_type` columns (fileable_type, taskable_type, etc.) store BIGINT integers in the database for efficiency. The framework maps between integer IDs and class names transparently.
```php
// Model: Declare type ref columns
protected static $type_ref_columns = ['fileable_type'];
// Usage: Code works with class name strings - conversion is automatic
$attachment->fileable_type = 'Contact_Model'; // Stored as integer in DB
echo $attachment->fileable_type; // Reads as 'Contact_Model'
```
**Simple Names Only**: Always use `class_basename($model)`, never `get_class($model)` (FQCNs)
Details: `php artisan rsx:man polymorphic`
---
## AJAX ENDPOINTS
```php