jeudi 29 octobre 2015

How can I make a variable that can be accessable throughout my entire application routes/views in Laravel?

I make a cURL request to an API

http://ift.tt/1LXh9TW


I got back this response

    Object
    data: Object
    first_name: "Bob"
    last_name: "Jones"
    message: "Success"
    status: 200

    ___

I grab the first name and last name and concatenate them together and stored into a variable call $name.

$fn = VSE::user('first_name',$username);
$ln = VSE::user('last_name',$username);
$name = ucwords($fn.' '.$ln); // Bob Jones

I want to display this $name on my navigation.

Sending this $name variable with everyview would be a little over kill.

I'm seeking for a better way of doing this.

What should I do to make that variable accessable throughout my application routes/views ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire