Province.php 635 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace App\Shop\Provinces;
  3. use App\Shop\Cities\City;
  4. use App\Shop\Countries\Country;
  5. use Illuminate\Database\Eloquent\Model;
  6. class Province extends Model
  7. {
  8. /**
  9. * The attributes that are mass assignable.
  10. *
  11. * @var array
  12. */
  13. protected $fillable = [
  14. 'name',
  15. 'country_id'
  16. ];
  17. /**
  18. * The attributes that should be hidden for arrays.
  19. *
  20. * @var array
  21. */
  22. protected $hidden = [];
  23. public function country()
  24. {
  25. return $this->belongsTo(Country::class);
  26. }
  27. public function cities()
  28. {
  29. return $this->hasMany(City::class);
  30. }
  31. }