send email

This commit is contained in:
faiqahzaman
2022-03-06 17:04:03 +08:00
parent d3bcc6449b
commit c1a5324340
8 changed files with 105 additions and 9 deletions
+32
View File
@@ -0,0 +1,32 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;
use App\Mail\notislelong;
use Symfony\Component\HttpFoundation\Response;
use App\Models\User;
class MailController extends Controller {
public function sendEmail() {
$users = User::where('user_type', 2)
->get();
foreach($users as $user)
{
$email = $user->email;
$mailData = [
'title' => 'Notis Lelongan Gadaian',
'url' => 'https://www.positronx.io' // show unpaid gadaian
];
Mail::to($email)->send(new notislelong($mailData));
}
return response()->json([
'message' => 'Email has been sent.'
], Response::HTTP_OK);
}
}
-7
View File
@@ -44,8 +44,6 @@ class NotisController extends Controller
public function notislelong()
{
$user = Auth::user();
$lelongid = CawanganLelong::join('lelong','cawangan_lelong.lelong_id','=','lelong.id')
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
@@ -112,8 +110,6 @@ class NotisController extends Controller
}
public function listnotis(Request $request){
@@ -155,9 +151,6 @@ class NotisController extends Controller
}
}