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'));
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function edit()
 {
     $prefectures = Util::getPrefectures();
     return view('users.edit')->with('prefectures', $prefectures);
 }
Exemplo n.º 3
0
 /**
  * Show the application registration form.
  *
  * @return \Illuminate\Http\Response
  */
 public function getRegister()
 {
     $prefectures = Util::getPrefectures();
     return view('auth.register')->with('prefectures', $prefectures);
 }