<?php

namespace App\Observers;
use Illuminate\Support\Facades\Auth;
use App\MessageType;
use Illuminate\Database\Eloquent\SoftDeletes;

class MessageTypeObserver
{
    /**
     * Handle the message type "created" event.
     *
     * @param  \App\MessageType  $messageType
     * @return void
     */
    public function created(MessageType $messageType)
    {
        //
    }

    /**
     * Handle the message type "updated" event.
     *
     * @param  \App\MessageType  $messageType
     * @return void
     */
    public function updated(MessageType $messageType)
    {
        //
    }

    /**
     * Handle the message type "deleted" event.
     *
     * @param  \App\MessageType  $messageType
     * @return void
     */
    public function deleted(MessageType $messageType)
    {
        $id = Auth::id();
        $messageType->deleted_by=$id;   
    }

    /**
     * Handle the message type "restored" event.
     *
     * @param  \App\MessageType  $messageType
     * @return void
     */
    public function restored(MessageType $messageType)
    {
        //
    }

    /**
     * Handle the message type "force deleted" event.
     *
     * @param  \App\MessageType  $messageType
     * @return void
     */
    public function forceDeleted(MessageType $messageType)
    {
        //
    }

     /**
     * Handle the MessageType "creating" event.
     *
     * @param  \App\MessageType  $MessageType
     * @return void
     */
    
    public function creating(MessageType $messageType)
    {
      
        $id = Auth::id();
        $messageType->created_by=$id;
        $messageType->updated_by=$id;   
    }

    /**
     * Handle the MessageType "updating" event.
     *
     * @param  \App\MessageType  $MessageType
     * @return void
     */
    public function updating(MessageType $messageType)
    {
      
        $id = Auth::id();
        $messageType->updated_by=$id;   
    }

    /**
     * Handle the MessageType "deleting" event.
     *
     * @param  \App\MessageType  $MessageType
     * @return void
     */
    public function deleting(MessageType $messageType)
    {
        $id = Auth::id();      
        $messageType->deleted_by=$id;   
    }
}
