BelongsToUserTrait.php 593 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: sdf_sky
  5. * Date: 15/12/16
  6. * Time: 下午6:26
  7. */
  8. namespace App\Models\Relations;
  9. trait BelongsToUserTrait
  10. {
  11. /**
  12. * Get the user relation.
  13. *
  14. * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
  15. */
  16. public function user()
  17. {
  18. return $this->belongsTo('App\Models\User');
  19. }
  20. /**
  21. * Get the user relation.
  22. *
  23. * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
  24. */
  25. public function userData()
  26. {
  27. return $this->belongsTo('App\Models\UserData','user_id');
  28. }
  29. }