/**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $objImgPoster = array();
     $gamePoster = GamePoster::where('user_id', $id)->select('poster_id')->get();
     if ($gamePoster->count() > 0) {
         foreach ($gamePoster as $value) {
             $find = Poster::where('poster_id', $value->poster_id)->select('image_default', 'poster_id')->get();
             array_push($objImgPoster, $find[0]);
         }
         return response()->json($objImgPoster);
     } else {
         return "empty";
     }
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function random($id)
 {
     $objInPoster = array();
     $find = 0;
     $gamePoster = GamePoster::where('user_id', $id)->select('poster_id')->get();
     if ($gamePoster->count() > 0) {
         foreach ($gamePoster as $key => $value) {
             array_push($objInPoster, $value->poster_id);
         }
         $find = 12 - $gamePoster->count();
         if ($find > 3) {
             $poster = DB::table('poster')->whereNotIn('poster_id', $objInPoster)->orderByRaw('RAND()')->take(3)->get();
         } else {
             if ($find > 0) {
                 $poster = DB::table('poster')->whereNotIn('poster_id', $objInPoster)->orderByRaw('RAND()')->take($find)->get();
             } else {
                 $poster = [];
             }
         }
     } else {
         $poster = DB::table('poster')->orderByRaw('RAND()')->take(3)->get();
     }
     return response()->json($poster);
 }