CpUser.php 547 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace App\Modules\CpUser\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class CpUser extends Model
  5. {
  6. protected $table = 'cp_users';
  7. protected $fillable = ['username','password','id_enabled','created_at','updated_at'];
  8. /**
  9. * 获取用户
  10. */
  11. public static function getCpUser($username) {
  12. return self::where(['username'=>$username])->first();
  13. }
  14. /**
  15. * 获取用户by id
  16. */
  17. public static function getCpUserById($id) {
  18. return self::where(['id'=>$id])->first();
  19. }
  20. }