public function run() { $this->trancate(); $geoZoneWithFPA23 = GeoZone::whereName("Geo Zone with FPA 23%")->first(); $geoZoneWithFPA8 = GeoZone::whereName("Geo Zone with FPA 8%")->first(); DB::table('tax_rates')->insert(array('name' => 'FPA 23%', 'geo_zone_id' => $geoZoneWithFPA23->id, 'rate' => 23)); DB::table('tax_rates')->insert(array('name' => 'FPA 8%', 'geo_zone_id' => $geoZoneWithFPA8->id, 'rate' => 8)); }
public function run() { $this->trancate(); $country = Country::whereName("Greece")->first(); $zoneAttica = Zone::whereName("Attica")->first(); $zoneIslands = Zone::whereName("Islands")->first(); $geoZoneWithFPA23 = GeoZone::whereName("Geo Zone with FPA 23%")->first(); $geoZoneWithFPA8 = GeoZone::whereName("Geo Zone with FPA 8%")->first(); DB::table('zones_to_geo_zones')->insert(array('zone_id' => $zoneAttica->id, 'geo_zone_id' => $geoZoneWithFPA23->id)); DB::table('zones_to_geo_zones')->insert(array('zone_id' => $zoneIslands->id, 'geo_zone_id' => $geoZoneWithFPA8->id)); }
public function actionIndex() { $geoZones = GeoZone::model()->findAll(); $this->render('index', array('geoZones' => $geoZones)); }