diff --git a/app/Http/Controllers/IndexController.php b/app/Http/Controllers/IndexController.php index 3b105df..a82e7e5 100644 --- a/app/Http/Controllers/IndexController.php +++ b/app/Http/Controllers/IndexController.php @@ -20,23 +20,19 @@ public function __invoke(Request $request) $work_samples = WorkSample::all(); - // global $response; - // try { - // $token = env("GITHUB_TOKEN"); - // - // $response = Http::withHeaders([ - // 'Authorization' => 'token ' . $token, - // ])->get('https://api.github.com/users/mohamadreza1388'); - // global $avatar; - // if ($response->successful()) { - // $avatar = $response->json('avatar_url'); - // Setting::where('key', 'main_picture')->first()->update([ - // 'value' => $avatar, - // ]); - // } - // } catch (Exception $e) { - // dd($e->getMessage()); - // } + global $response; + try { + $token = env("GITHUB_TOKEN"); + + $response = Http::withHeaders(['Authorization' => 'token ' . $token,])->get('https://api.github.com/users/mohamadreza1388'); + global $avatar; + if ($response->successful()) { + $avatar = $response->json('avatar_url'); + Setting::where('key', 'main_picture')->first()->update(['value' => $avatar,]); + } + } catch (Exception $e) { + dd($e->getMessage()); + } return view('index', compact('skills', 'work_samples')); }