forked from s421507/eOSP2
Zmiany przed pullem list rozwijanych
This commit is contained in:
commit
afa46e960b
@ -13,15 +13,15 @@ class DataController extends Controller
|
||||
return view('unit',compact('voivodeships'));
|
||||
}
|
||||
|
||||
public function getCounties($id)
|
||||
public function getCounties($id)
|
||||
{
|
||||
$counties = DB::table("powiaty")->where("wojewodztwo_id",$id)->pluck("name","id");
|
||||
return json_encode($counties);
|
||||
}
|
||||
|
||||
public function getCommunities($id)
|
||||
public function getCommunities($id)
|
||||
{
|
||||
$communities= DB::table("gminy")->where("powiat_id",$id)->pluck("name","id");
|
||||
return json_encode($communities);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,21 +20,37 @@ class fireStationController extends Controller
|
||||
public function store()
|
||||
{
|
||||
$this->validate(request(),[
|
||||
'name' => 'required|min:3|max:45',
|
||||
'unitName' => 'required|min:3|max:45',
|
||||
'number' => 'required|numeric',
|
||||
'voivodeship' => 'required',
|
||||
'county' => 'required',
|
||||
'community' => 'required',
|
||||
'postOffice' => 'required|min:3|max:45',
|
||||
'zipCode' => 'required|digits:5',
|
||||
'latitude' => ['required', 'regex:/^[-]?(([0-8]?[0-9])\.(\d+))|(90(\.0+)?)$/'],
|
||||
'longitude' => ['required', 'regex:/^[-]?((((1[0-7][0-9])|([0-9]?[0-9]))\.(\d+))|180(\.0+)?)$/'],
|
||||
'address' => 'required|min:3|max:45',
|
||||
'KRS' => 'required|digits:10',
|
||||
'NIP' => 'required|digits:10',
|
||||
'phoneNumber' => 'required|numeric|min:9|max:11',
|
||||
'phoneNumber' => 'required|digits:9',
|
||||
'email' => 'required|email|unique:fireStations',
|
||||
],
|
||||
[
|
||||
'required' => ':attribute jest wymagany(e).',
|
||||
'min' => ':attribute musi mieć przynajmniej :min znaki.',
|
||||
'max' => ':attribute musi mieć nie więcej niż :max znaków.',
|
||||
'numeric' => ':attribute może zawierać tylko cyfry.',
|
||||
'digits' => ':attribute musi składać się z :digits cyfr.',
|
||||
'unique' =>':attribute jest już zajęty.',
|
||||
'email' => 'Niepoprawny adres e-mail.',
|
||||
'latitude.regex' =>':attribute ma zakres od -90.0 do 90.0',
|
||||
'longitude.regex' =>':attribute ma zakres od -180.0 do 180.0'
|
||||
]);
|
||||
|
||||
|
||||
$request = request();
|
||||
$jednostka = fireStation::create([
|
||||
'name' => $request -> name,
|
||||
'name' => $request -> unitName,
|
||||
'number' => $request -> number,
|
||||
'voivodeship' => $request -> voivodeship,
|
||||
'county' => $request -> county,
|
||||
|
@ -151,6 +151,16 @@ return [
|
||||
'password' => 'hasło',
|
||||
'PESEL' => 'numer PESEL',
|
||||
'phoneNumber' => 'numer telefonu',
|
||||
'number' => 'numer jednostki',
|
||||
'zipCode' => 'kod pocztowy',
|
||||
'postOffice' => 'urząd pocztowy',
|
||||
'address' => 'adres',
|
||||
'voivodeship' => 'województwo',
|
||||
'county' => 'powiat',
|
||||
'community' => 'gmina',
|
||||
'unitName' => 'nazwa jednostki',
|
||||
'longitude' => 'długość geograficzna',
|
||||
'latitude' => 'szerokość geograficzna',
|
||||
],
|
||||
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
{{ csrf_field() }}
|
||||
<div class="form-group">
|
||||
<label for="name">Nazwa Jednostki:</label>
|
||||
<input type="text" class="form-control" id="name" name="name" value="{{ old('name') }} ">
|
||||
<input type="text" class="form-control" id="unitName" name="unitName" value="{{ old('unitName') }} ">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
@ -51,11 +51,11 @@ Route::get('/strazacy', 'fireFightersController@create');
|
||||
Route::get('/strazacy/add', 'fireFightersController@addForm');
|
||||
Route::post('/strazacy', 'fireFightersController@store');
|
||||
|
||||
|
||||
Route::get('/jednostka','DataController@getVoivodeships');
|
||||
Route::get('/jednostka/getcounties/{id}','DataController@getCounties');
|
||||
Route::get('/jednostka/getcommunities/{id}','DataController@getCommunities');
|
||||
|
||||
|
||||
//Auth::routes();
|
||||
//
|
||||
//Route::get('/home', 'HomeController@index')->name('home');
|
||||
|
Loading…
Reference in New Issue
Block a user