bug-fix-patch

Soleved user profile pic issue and application URL in outgoing mail.
This commit is contained in:
Manish Verma
2016-10-17 17:47:10 +05:30
parent c43c02c46f
commit ec61ab6c7a
2 changed files with 17 additions and 2 deletions

View File

@@ -47,7 +47,8 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
if (!$pic) {
$pic = asset('uploads/profilepic/'.$value);
}
if (!$pic) {
if ($this->endsWith($pic, 'profilepic')) {
$pic = \Gravatar::src($this->attributes['email']);
}
@@ -155,4 +156,18 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
return $this->user_name;
}
/**
* @category function to check profile pic source srting ends with profilepic or not
* @param string $haystack, $needle
* @return boolean true/false
*/
function endsWith($haystack, $needle)
{
$length = strlen($needle);
if ($length == 0) {
return true;
}
return (substr($haystack, -$length) === $needle);
}
}