<?php

namespace App\Modules\Stock;

use Illuminate\Support\Facades\Event;

class StockRequested
{
    /**
     * Subscribe to events.
     *
     * @param  mixed $events
     *
     * @return null
     */
    public function subscribe($events)
    {
        $events->listen('StockRequested', 'App\Modules\Stock\StockRequested@fire');
    }

    /**
     * Fire the event.
     *
     * @param  \App\Modules\Stock\Stock $stock
     *
     * @return bool
     */
    public function fire($stock, $quantity)
    {
        $stock->increment('quantity_to_order', $quantity);
    }
}
