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.

31 lines
764 B

  1. <?php
  2. namespace App\Models;
  3. use App\Models\Model;
  4. class Fingerprint extends Model
  5. {
  6. protected $fillable = ['user_id', 'agent', 'ip', 'os', 'latitude', 'longitude', 'token', 'fcm_token'];
  7. protected $table = 'fingerprints';
  8. public function user()
  9. {
  10. return $this->belongsTo(User::class, 'user_id', 'id', __FUNCTION__);
  11. }
  12. public function rules()
  13. {
  14. return [
  15. 'user_id' => 'required|integer|exists:users,id',
  16. 'agent' => 'required|string',
  17. 'ip' => 'required|ip',
  18. 'os' => 'required|string',
  19. 'latitude' => 'required',
  20. 'longitude' => 'required',
  21. 'token' => 'required|string|min:60',
  22. 'fcm_token' => 'nullable',
  23. ];
  24. }
  25. }