Exemple #1
0
 private function setRightMenu()
 {
     $rightMenu = \Menu::getMenu('rightMenu');
     if (auth()->check()) {
         $rightMenu->link('create_issue', function (Link $link) {
             $link->name = 'Create Issue';
             $link->url = route('issue.create');
             $link->type = 'button';
             $link->classes = 'btn btn-primary-outline';
         });
         $rightMenu->dropDown('user', auth()->user()->display_name, function (DropDown $dropDown) {
             $dropDown->type = 'profile';
             $dropDown->image = Gravatar::src(auth()->user()->email, 30);
             $dropDown->link('user_profile', function (Link $link) {
                 $link->name = 'Profile';
                 $link->url = route('user.profile');
             });
         });
     } else {
         $rightMenu->link('login', function (Link $link) {
             $link->name = 'Login';
             $link->url = route('auth.login');
         });
         $rightMenu->link('register', function (Link $link) {
             $link->name = 'Register';
             $link->url = route('auth.register');
         });
     }
 }
 public function home()
 {
     $users = User::get(['username', 'latitude', 'longitude', 'email']);
     $users->map(function ($user) {
         $user->avatar = Gravatar::src($user->email);
         $user->profile_url = route('profile_path', $user->username);
     });
     JavaScript::put(compact('users'));
     return view('pages.home');
 }
Exemple #3
0
 public function getAvatar()
 {
     $profile = $this->request->user()->profile;
     if ($profile->avatar_file_name) {
         $photo = $profile->avatar->url('medium');
     } else {
         $photo = Gravatar::src($this->request->user()->email, 360);
     }
     return view('users.update-avatar', compact('profile', 'photo'));
 }
Exemple #4
0
 /**
  * Diplay the user's profile image
  *
  * @return string
  */
 public function profileImage($width = null)
 {
     if (isset($this->entity->avatar)) {
         if (filter_var($this->entity->avatar, FILTER_VALIDATE_URL)) {
             return $this->entity->avatar;
         }
         if (!is_null($width)) {
             $width = "?w=" . $width;
         }
         return config('upload_paths.avatars') . $this->entity->avatar . $width;
     }
     return Gravatar::src($this->entity->email, $width);
 }
 /**
  * @return \Illuminate\View\View
  */
 public function home()
 {
     if (Cache::has('homepage-data')) {
         $data = Cache::get('homepage-data');
         return view('welcome', $data);
     }
     $config = array();
     $config['cluster'] = true;
     $config['zoom'] = '2';
     $config['https'] = true;
     $config['map_height'] = '500';
     $users = User::where('is_sitepoint', 'false')->get();
     $config['onboundschanged'] = 'if (!centreGot) {
         var mapCentre = map.getCenter();
         marker_0.setOptions({
             position: new google.maps.LatLng(mapCentre.lat(), mapCentre.lng())
         });
     }
     centreGot = true;';
     Gmaps::initialize($config);
     foreach ($users as $user) {
         if ($user->avatar) {
             $gravatar = '<img style="max-width: 45px; max-height: 45px;" class="img-circle" src="' . $user->avatar . '"/>';
         } else {
             $gravatar = '<img style="max-width: 45px; max-height: 45px;" class="img-circle" src="' . Gravatar::src($user->email) . '"/>';
         }
         if (!$user->latitude == null) {
             $marker = array();
             $marker['position'] = $user->latitude . ', ' . $user->longitude;
             $marker['draggable'] = true;
             $marker['animation'] = 'DROP';
             $marker['infowindow_content'] = '<div id="content"><div id="siteNotice"></div><div id="bodyContent"><p class="text-muted"><a href="' . url('@' . $user->username) . '">' . $gravatar . ' ' . $user->username . '</a></p></div></div>';
             Gmaps::add_marker($marker);
         }
     }
     $data = ['map' => Gmaps::create_map(), 'users' => $users];
     $expiresAt = Carbon::now()->addMinutes(5);
     Cache::put('homepage-data', $data, $expiresAt);
     return view('welcome', $data);
 }
Exemple #6
0
 public function getAvatarAttribute()
 {
     return Gravatar::src($this->user->email, 30);
 }