diff --git a/app/Http/Controllers/fireStationController.php b/app/Http/Controllers/fireStationController.php index 3a34d01..1338a78 100644 --- a/app/Http/Controllers/fireStationController.php +++ b/app/Http/Controllers/fireStationController.php @@ -27,7 +27,7 @@ class fireStationController extends Controller 'address' => 'required|min:3|max:45', 'KRS' => 'required|digits:10', 'NIP' => 'required|digits:10', - 'phoneNumber' => 'required|digits:11', + 'phoneNumber' => 'required|numeric|min:9|max:11', 'email' => 'required|email|unique:firestations', diff --git a/database/migrations/2019_09_19_113737_jednostki_terytorialne.php b/database/migrations/2019_09_19_113737_jednostki_terytorialne.php new file mode 100644 index 0000000..59f0176 --- /dev/null +++ b/database/migrations/2019_09_19_113737_jednostki_terytorialne.php @@ -0,0 +1,145 @@ +increments('id'); + $table->string('name'); + }); + + Schema::create('powiaty', function (Blueprint $table) { + $table->increments('id'); + $table->integer('wojewodztwo_id'); + $table->string('name'); + }); + + Schema::create('gminy', function (Blueprint $table) { + $table->increments('id'); + $table->integer('wojewodztwo_id'); + $table->integer('powiat_id'); + $table->string('name'); + }); + + + // dane testowe + DB::table('wojewodztwa')->insert( + array( + 'name' => 'wielkopolskie' + ) + ); + DB::table('wojewodztwa')->insert( + array( + 'name' => 'pomorskie' + ) + ); + + + + DB::table('powiaty')->insert( + array( + 'wojewodztwo_id' => '1', + 'name' => 'poznański' + ) + ); + DB::table('powiaty')->insert( + array( + 'wojewodztwo_id' => '1', + 'name' => 'koniński' + ) + ); + DB::table('powiaty')->insert( + array( + 'wojewodztwo_id' => '2', + 'name' => 'kartuski' + ) + ); + DB::table('powiaty')->insert( + array( + 'wojewodztwo_id' => '2', + 'name' => 'kwidzyński' + ) + ); + + + + DB::table('gminy')->insert( + array( + 'wojewodztwo_id' => '1', + 'powiat_id' => '1', + 'name' => 'Dopiewo' + ) + ); + DB::table('gminy')->insert( + array( + 'wojewodztwo_id' => '1', + 'powiat_id' => '1', + 'name' => 'Suchy Las' + ) + ); + DB::table('gminy')->insert( + array( + 'wojewodztwo_id' => '1', + 'powiat_id' => '2', + 'name' => 'Skulsk' + ) + ); + DB::table('gminy')->insert( + array( + 'wojewodztwo_id' => '1', + 'powiat_id' => '2', + 'name' => 'Wilczyn' + ) + ); + DB::table('gminy')->insert( + array( + 'wojewodztwo_id' => '2', + 'powiat_id' => '3', + 'name' => 'Sierakowice' + ) + ); + DB::table('gminy')->insert( + array( + 'wojewodztwo_id' => '2', + 'powiat_id' => '3', + 'name' => 'Chmielno' + ) + ); + DB::table('gminy')->insert( + array( + 'wojewodztwo_id' => '2', + 'powiat_id' => '4', + 'name' => 'Gardeja' + ) + ); + DB::table('gminy')->insert( + array( + 'wojewodztwo_id' => '2', + 'powiat_id' => '4', + 'name' => 'Sadlinki' + ) + ); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('wojewodztwa'); + Schema::dropIfExists('powiaty'); + Schema::dropIfExists('gminy'); + } +} diff --git a/resources/views/inc/addFireStation.blade.php b/resources/views/inc/addFireStation.blade.php index b91e622..de6ace7 100644 --- a/resources/views/inc/addFireStation.blade.php +++ b/resources/views/inc/addFireStation.blade.php @@ -2,6 +2,15 @@ @section('center-area') @parent + +
+