File size: 1,494 Bytes
40dca3b
 
 
 
 
 
2f6c20f
40dca3b
0c117c4
40dca3b
 
 
 
 
 
 
 
 
 
 
 
992488d
 
 
40dca3b
992488d
 
 
 
 
 
 
 
 
 
 
 
 
b4fd9af
 
 
 
c9f9d85
b4fd9af
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php

use App\Services\ComicServices;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Route;

use Illuminate\Support\Str;


/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/

Route::get('/oauth/gmail', function (){
    return LaravelGmail::redirect();
});

Route::get('/oauth2', function (){
    LaravelGmail::makeToken();
    return redirect()->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');