UnblockIp.php 569 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace App\Models;
  3. use App\Utils\Tools;
  4. class UnblockIp extends Model
  5. {
  6. protected $connection = "default";
  7. protected $table = "unblockip";
  8. public function user()
  9. {
  10. $user = User::where("id", $this->attributes['userid'])->first();
  11. if ($user == null) {
  12. UnblockIp::where('id', '=', $this->attributes['id'])->delete();
  13. return null;
  14. } else {
  15. return $user;
  16. }
  17. }
  18. public function time()
  19. {
  20. return date("Y-m-d H:i:s", $this->attributes['datetime']);
  21. }
  22. }