| 12345678910111213141516171819202122232425262728293031 | <?phpnamespace App\Modules\CpUser\Models;use Illuminate\Database\Eloquent\Model;class CpUser extends Model{    protected  $table = 'cp_users';    protected  $fillable = ['username','password','id_enabled','created_at','updated_at'];    /**     * 获取用户     */    public static function getCpUser($username) {        return self::where(['username'=>$username])->first();    }        /**     * 获取用户by id     */    public static function getCpUserById($id) {    	return self::where(['id'=>$id])->first();    }        //修改密码    static function modifyPassword($username, $password)    {        return self::where('username', $username)->update(compact('password'));    }}
 |