You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
893 B
43 lines
893 B
<?php
|
|
|
|
namespace App\Models\v3;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class User extends Model
|
|
{
|
|
protected $table = 'lanzu_user';
|
|
protected $dateFormat = 'U';
|
|
|
|
/**
|
|
* 获取单个用户信息
|
|
* @param int $id
|
|
* @param string $field
|
|
* @return object
|
|
*/
|
|
public static function getUserInfo($id,$field = '*')
|
|
{
|
|
return self::select($field)->find($id);
|
|
}
|
|
|
|
/**
|
|
* 获取用户数组
|
|
* id为键,name为值
|
|
* @return array
|
|
*/
|
|
public static function getUserArray()
|
|
{
|
|
$list = self::select('id','nick_name')
|
|
->where('status',1)
|
|
->whereNull('deleted_at')
|
|
->get();
|
|
$array = [];
|
|
if(count($list) > 0){
|
|
foreach ($list as $value) {
|
|
$array[$value->id] = $value->nick_name;
|
|
}
|
|
}
|
|
|
|
return $array;
|
|
}
|
|
}
|