first commit
This commit is contained in:
51
app/Models/UserInfo.php
Normal file
51
app/Models/UserInfo.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Traits\BelongsToUser;
|
||||
|
||||
class UserInfo extends Model
|
||||
{
|
||||
|
||||
use BelongsToUser;
|
||||
|
||||
protected $primaryKey = 'user_id';
|
||||
|
||||
/**
|
||||
* Notes: 获取性别的文字显示
|
||||
* @Author: <C.Jason>
|
||||
* @Date: 2019/9/12 09:46
|
||||
* @return string
|
||||
*/
|
||||
protected function getSexTextAttribute()
|
||||
{
|
||||
switch ($this->sex) {
|
||||
case 0 :
|
||||
return '保密';
|
||||
break;
|
||||
case 1 :
|
||||
return '男';
|
||||
break;
|
||||
case 2 :
|
||||
return '女';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 处理默认头像
|
||||
* @Author: <C.Jason>
|
||||
* @Date: 2019/9/12 13:44
|
||||
* @param $avatar
|
||||
* @return string
|
||||
*/
|
||||
protected function getAvatarAttribute($avatar)
|
||||
{
|
||||
if (blank($avatar)) {
|
||||
return 'timg.gif';
|
||||
} else {
|
||||
return $avatar;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user