forked from s421507/eOSP2
Signed-off-by: Krzysztof Strzelecki <ks37365@st.amu.edu.pl>
This commit is contained in:
parent
cbb82b014a
commit
033181f543
@ -20,23 +20,37 @@ class fireStationController extends Controller
|
|||||||
public function store()
|
public function store()
|
||||||
{
|
{
|
||||||
$this->validate(request(),[
|
$this->validate(request(),[
|
||||||
'name' => 'required|min:3|max:45',
|
'unitName' => 'required|min:3|max:45',
|
||||||
'number' => 'required|numeric',
|
'number' => 'required|numeric',
|
||||||
|
'voivodeship' => 'required',
|
||||||
|
'county' => 'required',
|
||||||
|
'community' => 'required',
|
||||||
'postOffice' => 'required|min:3|max:45',
|
'postOffice' => 'required|min:3|max:45',
|
||||||
'zipCode' => 'required|digits:5',
|
'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',
|
'address' => 'required|min:3|max:45',
|
||||||
'KRS' => 'required|digits:10',
|
'KRS' => 'required|digits:10',
|
||||||
'NIP' => 'required|digits:10',
|
'NIP' => 'required|digits:10',
|
||||||
'phoneNumber' => 'required|numeric|min:9|max:11',
|
'phoneNumber' => 'required|digits:9',
|
||||||
'email' => 'required|email|unique:firestations',
|
'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();
|
$request = request();
|
||||||
$jednostka = fireStation::create([
|
$jednostka = fireStation::create([
|
||||||
'name' => $request -> name,
|
'name' => $request -> unitName,
|
||||||
'number' => $request -> number,
|
'number' => $request -> number,
|
||||||
'voivodeship' => $request -> voivodeship,
|
'voivodeship' => $request -> voivodeship,
|
||||||
'county' => $request -> county,
|
'county' => $request -> county,
|
||||||
|
@ -151,6 +151,16 @@ return [
|
|||||||
'password' => 'hasło',
|
'password' => 'hasło',
|
||||||
'PESEL' => 'numer PESEL',
|
'PESEL' => 'numer PESEL',
|
||||||
'phoneNumber' => 'numer telefonu',
|
'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() }}
|
{{ csrf_field() }}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="name">Nazwa Jednostki:</label>
|
<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>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
Loading…
Reference in New Issue
Block a user