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,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Social extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'icon',
|
||||
'url_structure'
|
||||
];
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
|
||||
/**
|
||||
* Get all sociables that are assigned to this social.
|
||||
*/
|
||||
public function sociables()
|
||||
{
|
||||
return $this->morphedByMany(User::class, 'sociable');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all users that are assigned to this social.
|
||||
*/
|
||||
public function users()
|
||||
{
|
||||
return $this->morphedByMany(User::class, 'sociable')->where('sociable_type', User::class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all organizations that are assigned to this social.
|
||||
*/
|
||||
public function organizations()
|
||||
{
|
||||
return $this->morphedByMany(Organization::class, 'sociable')->where('sociable_type', Organization::class);
|
||||
;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user