PHP code example of ascension / laravel4-getgravatar
1. Go to this page and download the library: Download ascension/laravel4-getgravatar library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ascension / laravel4-getgravatar example snippets
// Defining an Avatar from a Route and passing it to the View
Route::get('/' , function()
{
$gravatar = \Gravatar::get() ;
return View::make('welcome')->with('gravatar' , $gravatar) ;
});
namespace Tournasdim\Admin\Controllers ;
class AdminController extends BaseController {
// No Email specified , Auth's adapter Interface will try to resolve user's Email address .
public function showWelcome()
{
$gravatar = \Gravatar::get() ;
return View::make('admin.dashboard')
->with('gravatar' , $gravatar) ;
}
}
namespace Tournasdim\Admin\Controllers ;
class AdminController extends BaseController {
// Email is specified , this will be used into the query-string
public function showWelcome()
{
$gravatar = \Gravatar::get(null , false , '[email protected]') ;
return View::make('admin.dashboard')
->with('gravatar' , $gravatar) ;
}
}
namespace Tournasdim\Admin\Controllers ;
class BaseController extends Controller {
protected $gravatar ;
public function __construct()
{
$this->gravatar = \Gravatar::get() ;
}