Files
Test-Eloquent-Relationships/app/Models/Attachment.php
T
2025-04-05 09:33:22 +09:00

19 lines
379 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Attachment extends Model
{
use HasFactory;
protected $fillable = ['filename', 'attachable_id', 'attachable_type'];
public function attachable()
{
return $this->morphTo(); // TASK: fill in the code to make it work
}
}