UserMessage.php
852 Bytes
<?php
namespace App\Models;
use App\Enums\ActivityAuditStatusEnum;
use App\Enums\ActivityStatusEnum;
use App\Support\Model;
use Awobaz\Compoships\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class UserMessage extends Model
{
use SoftDeletes;
protected $table = 'user_messages';
protected $hidden = ['deleted_at'];
/**
* @return \Awobaz\Compoships\Database\Eloquent\Relations\BelongsTo
*/
public function sender(): BelongsTo
{
return $this->belongsTo(User::class);
}
/**
* @return \Awobaz\Compoships\Database\Eloquent\Relations\BelongsTo
*/
public function activity(): BelongsTo
{
return $this->belongsTo(Activity::class)->where('audit_status', ActivityAuditStatusEnum::SUCCESS)->where('status', ActivityStatusEnum::UP);
}
}