UserW.php 557 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\SoftDeletes;
  4. use Illuminate\Database\Eloquent\Model;
  5. class UserW extends Model{
  6. use SoftDeletes;
  7. protected $connection = 'mysql_w';
  8. protected $table='user';
  9. protected $guarded=[];
  10. public function order()
  11. {
  12. return $this->hasMany(OrderW::class,'user_id');
  13. }
  14. public function scan()
  15. {
  16. return $this->hasMany(Scan::class,'user_id');
  17. }
  18. public function recom()
  19. {
  20. return $this->hasOne(UserW::class,'id','recomer_id');
  21. }
  22. }