fixing ui and test send email

pull/2/head
ajikamaludin 2 years ago
parent 74d46bd02c
commit 406c237c4f
Signed by: ajikamaludin
GPG Key ID: 476C9A2B4B794EBB

@ -2,8 +2,10 @@
namespace App\Http\Controllers;
use App\Mail\DocumentNotification;
use App\Models\Setting;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;
class SettingController extends Controller
{
@ -23,5 +25,9 @@ class SettingController extends Controller
Setting::where('key', 'DESTINATION_MAIL')->update([
'value' => $request->email,
]);
if ($request->has('test')) {
Mail::to($request->email)->send(new DocumentNotification());
}
}
}

@ -23,6 +23,15 @@ export default function Dashboard(props) {
})
}
const handleSubmitAndTest = () => {
post(route('setting.update', { test: 'test' }), {
onSuccess: () =>
Promise.all([
toast.success('The Data has been saved'),
]),
})
}
return (
<AuthenticatedLayout
auth={props.auth}
@ -32,8 +41,8 @@ export default function Dashboard(props) {
>
<Head title="Setting" />
<div className="flex flex-col w-full sm:px-6 lg:px-8 space-y-2">
<div className="card bg-base-100 w-full">
<div className="flex flex-row w-full justify-center sm:px-6 lg:px-8 space-y-2">
<div className="card bg-base-100 w-full max-w-md">
<div className="card-body">
<div className="form-control">
<label className="label">
@ -60,6 +69,13 @@ export default function Dashboard(props) {
>
Simpan
</div>
<div
onClick={handleSubmitAndTest}
className="btn btn-secondary"
disabled={processing}
>
Simpan & Test
</div>
</div>
</div>
</div>

Loading…
Cancel
Save