Zmiany przed pullem list rozwijanych

This commit is contained in:
czup 2019-10-01 20:03:20 +02:00
commit afa46e960b
5 changed files with 34 additions and 8 deletions

View File

@ -20,21 +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,

View File

@ -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',
], ],

View File

@ -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">

View File

@ -51,11 +51,11 @@ Route::get('/strazacy', 'fireFightersController@create');
Route::get('/strazacy/add', 'fireFightersController@addForm'); Route::get('/strazacy/add', 'fireFightersController@addForm');
Route::post('/strazacy', 'fireFightersController@store'); Route::post('/strazacy', 'fireFightersController@store');
Route::get('/jednostka','DataController@getVoivodeships'); Route::get('/jednostka','DataController@getVoivodeships');
Route::get('/jednostka/getcounties/{id}','DataController@getCounties'); Route::get('/jednostka/getcounties/{id}','DataController@getCounties');
Route::get('/jednostka/getcommunities/{id}','DataController@getCommunities'); Route::get('/jednostka/getcommunities/{id}','DataController@getCommunities');
//Auth::routes(); //Auth::routes();
// //
//Route::get('/home', 'HomeController@index')->name('home'); //Route::get('/home', 'HomeController@index')->name('home');