Address.php 628 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class Address extends Model
  5. {
  6. protected $table = 'address';
  7. public $timestamps=false;
  8. protected $fillable=['province','city','area','con_name','con_mobile','address','uid'];
  9. protected $hidden=['status'];
  10. public function user()
  11. {
  12. return $this->belongsTo(User::class,'uid','id');
  13. }
  14. public function users()
  15. {
  16. return $this->belongsTo(User::class,'mobile','mobile');
  17. }
  18. public function get_user(){
  19. return $this->belongsTo(User::class,'mobile','mobile')->whereIn('cert_status',[3,6]);
  20. }
  21. }