diff --git a/app/Http/Controllers/MailController.php b/app/Http/Controllers/MailController.php new file mode 100644 index 00000000..7fef14bc --- /dev/null +++ b/app/Http/Controllers/MailController.php @@ -0,0 +1,32 @@ +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); + } +} \ No newline at end of file diff --git a/app/Http/Controllers/NotisController.php b/app/Http/Controllers/NotisController.php index d747ae90..ceb92048 100644 --- a/app/Http/Controllers/NotisController.php +++ b/app/Http/Controllers/NotisController.php @@ -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 } - - - } \ No newline at end of file diff --git a/app/Mail/notislelong.php b/app/Mail/notislelong.php new file mode 100644 index 00000000..2a3cb7f7 --- /dev/null +++ b/app/Mail/notislelong.php @@ -0,0 +1,35 @@ +mailData = $mailData; + } + + /** + * Build the message. + * + * @return $this + */ + public function build() + { + return $this->markdown('Email.notispembida') + ->with('mailData', $this->mailData); + } +} diff --git a/resources/views/Email/demoEmail.blade.php b/resources/views/Email/demoEmail.blade.php new file mode 100644 index 00000000..fdb499ee --- /dev/null +++ b/resources/views/Email/demoEmail.blade.php @@ -0,0 +1,9 @@ +@component('mail::message') +# {{ $mailData['title'] }} +The body of your message. +@component('mail::button', ['url' => $mailData['url']]) +Button Text +@endcomponent +Thanks,
+{{ config('app.name') }} +@endcomponent \ No newline at end of file diff --git a/resources/views/Email/notispembida.blade.php b/resources/views/Email/notispembida.blade.php new file mode 100644 index 00000000..fdb499ee --- /dev/null +++ b/resources/views/Email/notispembida.blade.php @@ -0,0 +1,9 @@ +@component('mail::message') +# {{ $mailData['title'] }} +The body of your message. +@component('mail::button', ['url' => $mailData['url']]) +Button Text +@endcomponent +Thanks,
+{{ config('app.name') }} +@endcomponent \ No newline at end of file diff --git a/resources/views/includes/sidebar.blade.php b/resources/views/includes/sidebar.blade.php index 49d82f97..a8aa0f0a 100644 --- a/resources/views/includes/sidebar.blade.php +++ b/resources/views/includes/sidebar.blade.php @@ -69,6 +69,11 @@ Jana Notis Lelong +
  • Pembayaran Pemenang diff --git a/resources/views/mail/notislelong.blade.php b/resources/views/mail/notislelong.blade.php new file mode 100644 index 00000000..bc414282 --- /dev/null +++ b/resources/views/mail/notislelong.blade.php @@ -0,0 +1,12 @@ +@component('mail::message') +# Introduction + +The body of your message. + +@component('mail::button', ['url' => '']) +Button Text +@endcomponent + +Thanks,
    +{{ config('app.name') }} +@endcomponent diff --git a/routes/web.php b/routes/web.php index a8efecf8..73c1f9bf 100644 --- a/routes/web.php +++ b/routes/web.php @@ -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']); +}); - -}); \ No newline at end of file