<?php

use Orchestra\Messages\MessageBag;

if (! \function_exists('messages')) {
    /**
     * Add a message to the bag.
     *
     * @param  string  $key
     * @param  string|callable  $message
     *
     * @return \Orchestra\Messages\MessageBag
     */
    function messages(string $key, $message): MessageBag
    {
        return \app('orchestra.messages')->add(
            $key, \value($message)
        );
    }
}

<?php

use Orchestra\Support\Facades\Messages;
use Orchestra\Contracts\Messages\MessageBag;

if (! \function_exists('messages')) {
    /**
     * Add a message to the bag.
     *
     * @param  string  $key
     * @param  string|callable  $message
     *
     * @return \Orchestra\Contracts\Messages\MessageBag
     */
    function messages(string $key, $message): MessageBag
    {
        return Messages::add($key, \value($message));
    }
}

Use facade since it cache the singleton and set the interface for return type
Use facade since it cache the singleton and set the interface for return type

Signed-off-by: Mior Muhammad Zaki <e1a543840a942eb68427510a8a483282a7bfeddf@gmail.com>
