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.

40 lines
914 B

2 years ago
  1. <?php
  2. namespace App\Documents;
  3. use Illuminate\Database\Eloquent\Factories\HasFactory;
  4. use Illuminate\Notifications\Notifiable;
  5. use Jenssegers\Mongodb\Auth\User as Authenticatable;
  6. class UserDocument extends Authenticatable
  7. {
  8. use HasFactory, Notifiable, BaseDocument;
  9. public $incrementing = true;
  10. protected $connection = 'mongodb';
  11. protected $fillable = ['group_id', 'name', 'email', 'password'];
  12. protected $hidden = ['password', 'remember_token'];
  13. /**
  14. * The attributes that should be cast.
  15. *
  16. * @var array<string, string>
  17. */
  18. protected $casts = [
  19. 'email_verified_at' => 'datetime',
  20. ];
  21. public function can($abilities = [], $arguments = []): bool
  22. {
  23. foreach ($abilities as $permission) {
  24. if (in_array($permission, $this->permissions)) {
  25. return true;
  26. }
  27. }
  28. return false;
  29. }
  30. }