public function attach($className, callable $callback = null)
    {
        // If the user has passed through a callable item then we want
        // to attach the raw result of that call.
        if (is_callable($className)) {
            return ['raw' => $className];
        }

        if ( ! class_exists($className)) {
            throw new AttachmentClassNotFound("No class found with the name '{$className}'.");
        }

        return ['class' => new $className, 'callback' => $callback];
    }
public function attach($className, callable $callback = null)
    {
        // If the user has passed through a callable item then we want
        // to attach the raw result of that call.
        if (is_callable($className)) {
            return ['raw' => $className];
        }

        if ( ! class_exists($className)) {
            throw new AttachmentClassNotFound("No class found with the name '{$className}'.");
        }

        return ['class' => new $className, 'callback' => $callback];
    }
public function attach ( $ className , callable $ callback = null ) { // If the user has passed through a callable item then we want // to attach the raw result of that call. if ( is_callable ( $ className ) ) { return [ 'raw' => $ className ] ; } if ( ! class_exists ( $ className ) ) { throw new AttachmentClassNotFound ( "No class found with the name '{$className}'." ) ; } return [ 'class' => new $ className , 'callback' => $ callback ] ; }
Set the class to be used for the attachment.

@param string|callable $className
@param callable|bool   $callback
@return array
@throws AttachmentClassNotFound
Set the class to be used for the attachment .