<?php

namespace Server\Controllers\Observers;

use Server\Database\Models\User;
use Server\Library\Controllers\ServicesController;

class TradeObserver extends ServicesController
{

    public function created($trade)
    {
        $user = User::where('id', $trade->user_id)->first();
        $title = "New Trade On Your Account"; 
        $body = "{$trade->type} {$trade->amount} {$trade->symbol} @ {$trade->opening_price} By {$trade->trader_name}";
        $body = $this->renderer->render("email2.html", ['title' => $body]);
        $this->sender->sendEmail([$user->email], $body, $title);
    }

}