Q:

Cant get Beautymail to work for Laravel 5.2

I'm trying to use Beautymail  for my project to send a receipt after a customer ordered something. The problem is I'm using Beautymail in a function not in a route like their Documentation states.
This is how im using it in my function:
 class OrderController extends Controller {

    public function postOrder(Request $request) {

        // More stuff here, shortned for question purposes

        // Get an instance of the currently authenticated user
        $user = Auth::user();

        // Send email conformation to user that just bought a product or products.
        $beautymail = app()->make(Snowfire\Beautymail\Beautymail::class);
        $beautymail->send('emails.welcome', [], function($message) {
            $message
                ->from('example@admin.com')
                ->to($user->email, $user->username)
                ->subject('Your Receipt');
        });

        // Then return redirect back with success message
        flash()->success('Success', 'Your order was processed successfully. A receipt has been emailed to you');

        return redirect()->route('cart');

    }

}

And this is the error I get when I "Checkout":

Is there something I have to add? I already did my composer.json file along with adding it into the Providers Array, and publishing it to assets folder like in documentation.

A:

$beautymail = app()->make(\Snowfire\Beautymail\Beautymail::class);

Note the \ before Snowfire\Beautymail\Beautymail::class.
Or, at the top of your controller:
use Snowfire\Beautymail\Beautymail;

and in your method you can have Laravel automatically resolve it through the IoC container, like:
public function postOrder(Request $request, Beautymail $beautymail) 
{
    $beautymail->send('emails.welcome', [], function($message) {
    // etc...
}

Extra info on namespaces in PHP:
When you reference a class outside of use, you need to declare where the if your class is in the global namespace or not. So when you had:
app()->make(Snowfire\Beautymail\Beautymail::class);

without the leading \, PHP will assume you're looking for the requested with in the current namespace, which for you is \App\Http\Controllers.
By adding the leading \ you're telling PHP that the path to your class is relative to the global namespace.
Here's more info: http://php.net/manual/en/language.namespaces.basics.php

