send email
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class notislelong extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public $mailData;
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($mailData)
|
||||
{
|
||||
$this->mailData = $mailData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the message.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
return $this->markdown('Email.notispembida')
|
||||
->with('mailData', $this->mailData);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
@component('mail::message')
|
||||
# {{ $mailData['title'] }}
|
||||
The body of your message.
|
||||
@component('mail::button', ['url' => $mailData['url']])
|
||||
Button Text
|
||||
@endcomponent
|
||||
Thanks,<br>
|
||||
{{ config('app.name') }}
|
||||
@endcomponent
|
||||
@@ -0,0 +1,9 @@
|
||||
@component('mail::message')
|
||||
# {{ $mailData['title'] }}
|
||||
The body of your message.
|
||||
@component('mail::button', ['url' => $mailData['url']])
|
||||
Button Text
|
||||
@endcomponent
|
||||
Thanks,<br>
|
||||
{{ config('app.name') }}
|
||||
@endcomponent
|
||||
@@ -69,6 +69,11 @@
|
||||
<a href="{{url('jananotis/notislelong')}}">Jana Notis Lelong</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="list-unstyled collapse {{ (request()->is('jananotis/*')) ? 'show' : '' }}" id="jananotisSubmenu" >
|
||||
<li class="{{ (request()->is('jananotis/pembida/*') || request()->is('jananotis/pembida') ) ? 'active' : '' }}">
|
||||
<a href="{{url('jananotis/send-email')}}">Notis Pembida</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="{{ ( request()->is('pembayaran/kaunter/*')) ? 'active' : '' }}">
|
||||
<a href="{{url('pembayaran/SenaraiLelongBayar')}}">Pembayaran Pemenang</a>
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
@component('mail::message')
|
||||
# Introduction
|
||||
|
||||
The body of your message.
|
||||
|
||||
@component('mail::button', ['url' => ''])
|
||||
Button Text
|
||||
@endcomponent
|
||||
|
||||
Thanks,<br>
|
||||
{{ config('app.name') }}
|
||||
@endcomponent
|
||||
+3
-2
@@ -175,10 +175,11 @@ Route::group(['middleware' => ['permission:pengesahanbayaran'],'prefix'=>'accoun
|
||||
|
||||
Route::group(['middleware' => ['permission:jananotis'],'prefix'=>'jananotis'], function () {
|
||||
Route::get('/notislelong',['as'=>'jananotis.notislelong','uses'=>'NotisController@notislelong']);
|
||||
Route::get('/pembida',['as'=>'jananotis.pembida','uses'=>'NotisController@pembida']);
|
||||
Route::get('/senarainotis/{lelong_id}',['as'=>'jananotis.senarainotis','uses'=>'NotisController@senarainotis']);
|
||||
Route::get('/jananotis/{lelong_id}',['as'=>'jananotis.jananotis','uses'=>'NotisController@jananotis']);
|
||||
Route::post('/listnotis',['as'=>'jananotis.listnotis','uses'=>'NotisController@listnotis']);
|
||||
Route::get('/send-email',['as'=>'jananotis.email','uses'=>'MailController@sendEmail']);
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user