Skip to content

Commit

Permalink
feat(github)
Browse files Browse the repository at this point in the history
  • Loading branch information
tikrack committed Nov 1, 2024
1 parent 682a788 commit b73f3d5
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions app/Http/Controllers/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}
Expand Down

0 comments on commit b73f3d5

Please sign in to comment.