Advertisement
Ostap34PHP

Untitled

Jan 13th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.48 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App;
  4.  
  5. use Illuminate\Database\Eloquent\Model;
  6.  
  7. class ProductPosition extends Model
  8. {
  9.     protected $fillable = ['product_id', 'region_id', 'body'];
  10.  
  11.     public function city()
  12.     {
  13.         return $this->hasManyThrough('App\City', 'App\Region', 'id', 'id');
  14.     }
  15.  
  16.     public function region()
  17.     {
  18.         return $this->belongsTo('App\Region');
  19.     }
  20.  
  21.     public function product()
  22.     {
  23.         return $this->belongsTo('App\Product');
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement