Store.php 683 B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. use Illuminate\Database\Eloquent\SoftDeletes;
  5. class Store extends Model
  6. {
  7. use SoftDeletes;
  8. protected $table='store';
  9. protected $fillable = ['name','type','contents','status','address','man_id','province','city','area','warea_id','size','img','decorate_account'];
  10. public function agent()
  11. {
  12. return $this->belongsToMany('App\Models\User','store_user','store_id','user_id');
  13. }
  14. public function manager()
  15. {
  16. return $this->hasOne('App\Models\User','id','man_id');
  17. }
  18. public function user()
  19. {
  20. return $this->belongsTo('App\Models\User','man_id');
  21. }
  22. }