Created
May 9, 2014 18:54
-
-
Save ahmadshah/d66932938dd134a5521c to your computer and use it in GitHub Desktop.
Orchestra notifier trait
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Ochestra\Model\User; | |
use Orchestra\Support\Facades\Notifier; | |
trait NotifiableTrait { | |
/** | |
* Send email notification to user | |
* | |
* @param Orchestra\Model\User $user | |
* @param string $subject | |
* @param string $view | |
* @param array $data | |
* @return boolean | |
*/ | |
protected function sendNotification(User $user, $subject, $view, array $data) | |
{ | |
$data = array_add($data, 'user', $user->toArray()); | |
$message = new Fluent([ | |
'subject' => $subject, | |
'view' => $view, | |
'data' => $data | |
]); | |
$sent = Notifier::send($user, $message); | |
return ($sent) ? true : false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment