User.php 881 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Auth\Authenticatable;
  4. use Illuminate\Database\Eloquent\Model;
  5. use Illuminate\Auth\Passwords\CanResetPassword;
  6. use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
  7. use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
  8. class User extends Model implements AuthenticatableContract, CanResetPasswordContract
  9. {
  10. use Authenticatable, CanResetPassword;
  11. /**
  12. * The attributes that are mass assignable.
  13. *
  14. * @var array
  15. */
  16. protected $fillable = [
  17. 'name', 'email', 'password', 'admin',
  18. ];
  19. /**
  20. * The attributes excluded from the model's JSON form.
  21. *
  22. * @var array
  23. */
  24. protected $hidden = [
  25. 'password', 'remember_token',
  26. ];
  27. public function posts()
  28. {
  29. return $this->hasMany('App\Models\Post');
  30. }
  31. }