/**
  * Display the specified resource.
  *
  * @param  string  $slug
  * @return Response
  */
 public function show($slug)
 {
     // get the artwork by the slug
     $artwork = Artwork::whereSlug($slug)->first();
     $artist = Artist::where('artists.id', '=', $artwork->artist)->first();
     if ($artist == null) {
         $artist['name'] = "-";
         $artist['profileLink'] = "";
     } else {
         if ($artist->user_id != 0) {
             $userProfileSlug = DB::table('users')->where('id', $artist->user_id)->select('slug')->get();
             $artist->profileLink = "/users/" . $userProfileSlug[0]->slug;
         } else {
             $artist->profileLink = "/artists/show/" . $artist->id;
         }
     }
     $tagArray = $artwork->tagNames();
     $reservations = DB::table('reservations')->join('artworks', function ($join) {
         $join->on('reservations.artwork_id', '=', 'artworks.id')->where('artworks.reserved', '>', 0);
     })->join('users', function ($join) {
         $join->on('reservations.user_id', '=', 'users.id');
     })->select(['*', DB::raw('users.slug as userSlug'), DB::raw('artworks.slug as artworkSlug'), DB::raw('artworks.id as artworkId'), DB::raw('users.id as userId'), DB::raw('reservations.id as reservationId')])->where('artworks.id', '=', $artwork->id)->get();
     if ($artwork) {
         $tagArray = $artwork->tagNames();
         return View::make('artworks/show')->with(compact('artwork', 'tagArray', 'reservations', 'artist'));
         // get the tags
     } else {
         // Show a not found page
         return View::make('errors/' . HttpCode::NotFound);
     }
 }