to('/'); }); Route::get('/oauth/gmail/logout', function (){ LaravelGmail::logout(); //It returns exception if fails return redirect()->to('/'); }); Route::post('/github-webhook', function () { return "ok"; }); Route::get('/update-gmail', function () { $giaTriX = request()->query('x'); $duongDanFile=base_path('public')."/"."gmail/tokens/gmail-json.json"; // Thay thế bằng đường dẫn thực tế đến file của bạn $noiDung = 'Đây là nội dung chuỗi mà tôi muốn ghi vào file.'; try { File::put($duongDanFile, $giaTriX); echo 'Đã ghi thành công vào file.'; } catch (\Exception $e) { echo 'Có lỗi xảy ra khi ghi file: ' . $e->getMessage(); } })->name('test11');