Snapshot of main at 9f39a6e1e (2026-11-02)
This commit is contained in:
commit
6ccf1792d7
2580 files changed
+1040202
No files matched your search
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Post;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphToMany;
|
||||
|
||||
class Image extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = ['path','position','caption'];
|
||||
|
||||
|
||||
/**
|
||||
* Get the related posts of the images
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function posts(): MorphToMany
|
||||
{
|
||||
return $this->morphedByMany(Post:: class, 'imageable');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user