Question: Is there a function or something in laravel which I can use to make first letter uppercase in breadcrumbs? 

This is what I'm using right now but in my links and routes are all lowercase letters and if I go and try to update all will be very time consuming..

```
<ul class="breadcrumb">
<li>
     <i class="glyphicon glyphicon-home"></i>
     <a href="{{ URL::to('/') }}">Home</a> /
     @for($i = 0; $i <= count(Request::segments()); $i++)
         <a href="">{{Request::segment($i)}}</a>
         @if($i < count(Request::segments()) & $i > 0)
              /
         @endif
</li>
     @endfor
</ul>

```

Or this isn't correct way of making breadcrumbs in laravel 4.2?

Answer: 
Yes and no. 

It is not possible at the time of writing, if you want to do it only with browser client side javascript, because twitter does not allow cross site requests. 

Browsers execute javascript code in a sandbox environment, which does not allow you to do a request to another domain as yours, except the 3rd party domain explicitly allows it. This is called [Http Access Control (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS)

However the twitter api can of course be consumed by a javascript app, which is not running in a browser. 

So if you want this functionality for your website and you want to code it only in javascript, you would have to write a backend api for your website in nodejs or use another 3rd party service like @RationalDev suggested
This javascript snippet is a working example of how to do this. You can try it and tweak it: <https://jsfiddle.net/s3egg5h7/43/>

As pointed out, a Javascript-only solution requires a 3rd-party service, in this case <https://oauth.io>.

Even if you do not want to use the 3rd-party service, the snippet is useful since you do not have to write any code to test out Twitter APIs to see they return what you need

It is pretty short:

```
$('#twitter-button').on('click', function() {
    // Initialize with your OAuth.io app public key
    OAuth.initialize('OAUTH_IO_KEY');
    // Use popup for OAuth
    OAuth.popup('twitter').then(twitter => {
        console.log('twitter:', twitter);
        // Retrieves user data from OAuth provider by using #get() and
        // OAuth provider url    
        twitter.get('/1.1/account/verify_credentials.json?include_email=true').then(data => {
            console.log('self data:', data);
        })    
    });
})

```

It requires a few external references, e.g., bootstrap css, oauthio javascript open-source library, etc.

I think using a 3rd-party service may make sense since it hides all the inconsistencies in the OAuth implementation of different providers, like Twitter, Facebook, etc.

I did not create this code so for attribution purposes, please refer to: <https://coderwall.com/p/t46-ta/javascript-twitter-social-login-button-for-oauth>