public function show($id, Request $request)
 {
     $user = User::findOrFail($id);
     $prefectures = Util::getPrefectures();
     $prefecture = $prefectures[$user->prefecture];
     $line = Util::getLineNameFromLineIndex($user->line);
     $station = Util::getStationNameFromStationIndex($user->station);
     $active = ['list' => '', 'favorites' => '', 'followers' => '', 'follows' => ''];
     $url = ['list' => "href=/writers/{$id}", 'favorites' => "href=/writers/{$id}/favorites", 'followers' => "href=/writers/{$id}/followers", 'follows' => "href=/writers/{$id}/follows"];
     $path = $request->path();
     $writers = [];
     $articles = [];
     $follow = $user->checkFollow();
     switch ($path) {
         case "writers/{$id}/followers":
             $writers = $user->followedUsers()->paginate(10);
             $url['followers'] = '';
             $active['followers'] = 'active';
             break;
         default:
             $articles = $user->articles()->latest('published_at')->published()->paginate(10);
             $active['list'] = 'active';
             $url['list'] = '';
             break;
     }
     return view('users.show', compact('user', 'prefecture', 'line', 'station', 'articles', 'writers', 'active', 'url', 'follow'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function show(Request $request)
 {
     $user = \Auth::user();
     // dd($user->profile_image);
     $prefectures = Util::getPrefectures();
     $prefecture = $user->prefecture !== NULL ? $prefectures[$user->prefecture] : NULL;
     $line = Util::getLineNameFromLineIndex($user->line);
     $station = Util::getStationNameFromStationIndex($user->station);
     $active = ['list' => '', 'favorites' => '', 'followers' => '', 'follows' => ''];
     $url = ['list' => 'href=/user', 'favorites' => 'href=/user/favorites', 'followers' => 'href=/user/followers', 'follows' => 'href=/user/follows'];
     $path = $request->path();
     $writers = [];
     $articles = [];
     switch ($path) {
         case 'user/favorites':
             $articles = $user->favorites()->latest('published_at')->published()->paginate(10);
             $active['favorites'] = 'active';
             $url['favorites'] = '';
             break;
         case 'user/followers':
             $writers = $user->followedUsers()->paginate(10);
             $url['followers'] = '';
             $active['followers'] = 'active';
             break;
         case 'user/follows':
             $writers = $user->followUsers()->paginate(10);
             $url['follows'] = '';
             $active['follows'] = 'active';
             break;
         default:
             $articles = $user->articles()->latest('published_at')->published()->paginate(10);
             $active['list'] = 'active';
             $url['list'] = '';
             break;
     }
     return view('users.show', compact('user', 'prefecture', 'line', 'station', 'articles', 'writers', 'active', 'url'));
 }