mirror of https://github.com/pixelfed/pixelfed
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
3.0 KiB
PHP
84 lines
3.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
use Illuminate\Support\Carbon;
|
|
|
|
/**
|
|
* @property int $id
|
|
* @property int $profile_id
|
|
* @property int|null $actor_id
|
|
* @property int|null $item_id
|
|
* @property string|null $item_type
|
|
* @property string|null $action
|
|
* @property string|null $read_at
|
|
* @property Carbon|null $created_at
|
|
* @property Carbon|null $updated_at
|
|
* @property Carbon|null $deleted_at
|
|
* @property-read Profile|null $actor
|
|
* @property-read Model|\Eloquent|null $item
|
|
* @property-read Profile|null $profile
|
|
* @property-read Status|null $status
|
|
* @property-read MediaTag|null $tag
|
|
*
|
|
* @method static \Illuminate\Database\Eloquent\Builder<static>|Notification newModelQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder<static>|Notification newQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder<static>|Notification onlyTrashed()
|
|
* @method static \Illuminate\Database\Eloquent\Builder<static>|Notification query()
|
|
* @method static \Illuminate\Database\Eloquent\Builder<static>|Notification whereAction($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder<static>|Notification whereActorId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder<static>|Notification whereCreatedAt($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder<static>|Notification whereDeletedAt($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder<static>|Notification whereId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder<static>|Notification whereItemId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder<static>|Notification whereItemType($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder<static>|Notification whereProfileId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder<static>|Notification whereReadAt($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder<static>|Notification whereUpdatedAt($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder<static>|Notification withTrashed(bool $withTrashed = true)
|
|
* @method static \Illuminate\Database\Eloquent\Builder<static>|Notification withoutTrashed()
|
|
*
|
|
* @mixin \Eloquent
|
|
*/
|
|
class Notification extends Model
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $guarded = [];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'deleted_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
public function actor()
|
|
{
|
|
return $this->belongsTo(Profile::class, 'actor_id', 'id');
|
|
}
|
|
|
|
public function profile()
|
|
{
|
|
return $this->belongsTo(Profile::class, 'profile_id', 'id');
|
|
}
|
|
|
|
public function item(): MorphTo
|
|
{
|
|
return $this->morphTo();
|
|
}
|
|
|
|
public function status()
|
|
{
|
|
return $this->belongsTo(Status::class, 'item_id', 'id');
|
|
}
|
|
|
|
public function tag()
|
|
{
|
|
return $this->hasOne(MediaTag::class, 'item_id', 'id');
|
|
}
|
|
}
|