Skip to content

Instantly share code, notes, and snippets.

@EricMcWinNer
Created July 22, 2021 03:03
Show Gist options
  • Save EricMcWinNer/6b7c28fa12a7eb653b1dd84b217364e6 to your computer and use it in GitHub Desktop.
Save EricMcWinNer/6b7c28fa12a7eb653b1dd84b217364e6 to your computer and use it in GitHub Desktop.
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
/**
* Get the user's first name.
*
* @param string $value
* @return string
*/
public function getFirstNameAttribute($value)
{
return ucfirst($value);
}
/**
* Get the user's phone number by combining the country code with the actual number.
*
* @return string
*/
public function getPhoneNumberAttribute()
{
return $this->country_code . $this->phone;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment