app/Models/InventoryStock.php
public function getLastMovementAttribute()
    {
        if ($this->movements->count() > 0) {
            $movement = $this->movements->first();

            if ($movement instanceof InventoryStockMovement
                && $movement->after > $movement->before) {
                return sprintf('<b>%s</b> (Stock was added - %s) - <b>Reason:</b> %s', $movement->change, $movement->created_at, $movement->reason);
            } elseif ($movement->before > $movement->after) {
                return sprintf('<b>%s</b> (Stock was removed - %s) - <b>Reason:</b> %s', $movement->change, $movement->created_at, $movement->reason);
            } else {
                return sprintf('<b>%s</b> (No Change - %s) - <b>Reason:</b> %s', $movement->change, $movement->created_at, $movement->reason);
            }
        }

        return;
    }
public function getLastMovementAttribute()
    {
        if ($this->movements->count() > 0) {
            $movement = $this->movements->first();

            if ($movement instanceof InventoryStockMovement
                && $movement->after > $movement->before) {
                return sprintf('<b>%s</b> (Stock was added - %s) - <b>Reason:</b> %s', $movement->change, $movement->created_at, $movement->reason);
            } elseif ($movement->before > $movement->after) {
                return sprintf('<b>%s</b> (Stock was removed - %s) - <b>Reason:</b> %s', $movement->change, $movement->created_at, $movement->reason);
            } else {
                return sprintf('<b>%s</b> (No Change - %s) - <b>Reason:</b> %s', $movement->change, $movement->created_at, $movement->reason);
            }
        }

        return;
    }
Accessor for viewing the last movement of the stock.

@return null|string