<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class ActiviteMessage extends Model
{
    protected $primaryKey = 'ID_Message';
    protected $table = 'activite_messages';
    public $incrementing = true;
    public $timestamps = false;

    protected $fillable = [
        'Message',
        'ID_Utilisateur_Emetteur',
        'ID_Instance',
    ];

    protected $casts = [
        'Timestamp' => 'datetime',
    ];

    public function emetteur()
    {
        return $this->belongsTo(Utilisateur::class, 'ID_Utilisateur_Emetteur', 'ID_Utilisateur');
    }

    public function activite()
    {
        return $this->belongsTo(Activite::class, 'ID_Instance', 'ID_Instance');
    }
}
