-
-
Save whitneyburton/41782a084fef145d630834592b674da8 to your computer and use it in GitHub Desktop.
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
// app/Http/Controllers/HooksController.php | |
<?php | |
namespace App\Http\Controllers; | |
use Illuminate\Http\Request; | |
use Illuminate\Support\Facades\Mail; | |
use App\Mail\SendMailable; | |
class HooksController extends Controller | |
{ | |
public function sendmails(Request $request) | |
{ | |
$payload = $request->all(); | |
if($payload['type'] == "message.new"){ | |
foreach ($payload["members"] as $member) { | |
if($member\["user"\]["online"] == false){ | |
$email = $member\["user"\]["id"]."@gmail.com"; | |
Mail::to($email)->send(new SendMailable($member\["user"\]["name"])); | |
return 'Email was sent'; | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment