/**
  * Get a single User using
  * his user ID and user type
  *
  * @param $userId
  * @param $type
  * @return \App\Eloquent\User|null
  */
 public function getUser($userId, $type)
 {
     try {
         //Try to find the user with the ID and type specified
         return $this->user->where('user_type', '=', $type)->findOrFail($userId);
     } catch (Exception $e) {
         //Unexpected error
         return null;
     }
 }
 /**
  * Seed invitations for a user
  *
  * @param string $userId
  */
 public function seedInvitations($userId = '')
 {
     //Unguard model
     Model::unguard();
     $numRequestToSend = mt_rand(10, 100);
     //Get the user
     $user = \App\Eloquent\User::findOrFail($userId);
     //Get number of users accordingly
     $users = \App\Eloquent\User::where('id', '!=', $userId)->orderByRaw('RAND()')->limit($numRequestToSend)->get();
     //Seed friend request
     foreach ($users as $someUser) {
         //Create friend request for user
         $user->receivedFriendRequests()->create(['sender' => $someUser->id, 'notified' => false]);
     }
     echo $numRequestToSend . ' requests created';
     Model::reguard();
 }