Zawieszanie użytkownika
This commit is contained in:
parent
2c025bb535
commit
3f9424f6b5
@ -15,7 +15,14 @@ class SessionsController extends Controller
|
|||||||
{
|
{
|
||||||
if (auth()->attempt(request(['email', 'password'])) == false) {
|
if (auth()->attempt(request(['email', 'password'])) == false) {
|
||||||
return back()->withErrors([
|
return back()->withErrors([
|
||||||
'message' => 'The email or password is incorrect, please try again'
|
'message' => 'Podany adres email lub hasło jest nieprawidłowe, proszę spróbować ponownie.'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
elseif(auth()->user()->statusID == 1)
|
||||||
|
{
|
||||||
|
auth()->logout();
|
||||||
|
return back()->withErrors([
|
||||||
|
'message' => 'Twoje konto zostało zawieszone.'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,5 +138,23 @@ class fireFightersController extends Controller
|
|||||||
return fireFightersController::create();
|
return fireFightersController::create();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function activate()
|
||||||
|
{
|
||||||
|
$request = request();
|
||||||
|
$user = User::find( $request-> userID);
|
||||||
|
$user-> statusID = 0;
|
||||||
|
$user->save();
|
||||||
|
return redirect()->to('/strazacy');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deactivate()
|
||||||
|
{
|
||||||
|
$request = request();
|
||||||
|
$user = User::find( $request-> userID);
|
||||||
|
$user-> statusID = 1;
|
||||||
|
$user->save();
|
||||||
|
return redirect()->to('/strazacy');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,17 +96,23 @@
|
|||||||
<td>
|
<td>
|
||||||
<a href="{{ URL::asset('strazacy/edit/'.$user->id) }}" class="btn btn-secondary" role="button">Edytuj</a>
|
<a href="{{ URL::asset('strazacy/edit/'.$user->id) }}" class="btn btn-secondary" role="button">Edytuj</a>
|
||||||
<a href="{{ URL::asset('strazacy/odznaczenia/'.$user->id) }}" class="btn btn-success" role="button">Odznaczenia</a>
|
<a href="{{ URL::asset('strazacy/odznaczenia/'.$user->id) }}" class="btn btn-success" role="button">Odznaczenia</a>
|
||||||
|
@if( auth()->user()->id != $user->id)
|
||||||
|
@if ($user->statusID == 0)
|
||||||
|
<form method="POST" action="/strazacy/deactivate" style="display:inline;">
|
||||||
|
{{ csrf_field() }}
|
||||||
|
<input type="hidden" class="form-control" name="userID" value="{{ $user->id }}">
|
||||||
|
<button style="cursor:pointer" type="submit" class="btn btn-primary">Zawieś</button>
|
||||||
|
</form>
|
||||||
|
@elseif ($user->statusID == 1)
|
||||||
|
<form method="POST" action="/strazacy/activate" style="display:inline;" >
|
||||||
|
{{ csrf_field() }}
|
||||||
|
<input type="hidden" class="form-control" name="userID" value="{{ $user->id }}">
|
||||||
|
<button style="cursor:pointer" type="submit" class="btn btn-primary">Przywróć do służby</button>
|
||||||
|
</form>
|
||||||
|
@endif
|
||||||
|
@endif
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{-- <tr>--}}
|
|
||||||
{{-- <form id="editForm{{$user->id}}" method="POST" action="/strazacy">--}}
|
|
||||||
{{-- {{ csrf_field() }}--}}
|
|
||||||
{{-- <div class="form-group">--}}
|
|
||||||
{{-- <label for="name">Imię:</label>--}}
|
|
||||||
{{-- <input type="text" class="form-control" id="name" name="name" value="{{ old('name') }} ">--}}
|
|
||||||
{{-- </div>--}}
|
|
||||||
{{-- </form>--}}
|
|
||||||
{{-- </tr>--}}
|
|
||||||
@php
|
@php
|
||||||
$i++;
|
$i++;
|
||||||
@endphp
|
@endphp
|
||||||
|
@ -41,10 +41,10 @@
|
|||||||
<th>Adres e-mail:</th>
|
<th>Adres e-mail:</th>
|
||||||
<td>{{ $userData->email}}</td>
|
<td>{{ $userData->email}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
{{-- <tr> --}}
|
||||||
<th>Numer ewidencyjny:</th>
|
{{-- <th>Numer ewidencyjny:</th> --}}
|
||||||
<td>{{ $userData->number}}</td>
|
{{-- <td>{{ $userData->number}}</td> --}}
|
||||||
</tr>
|
{{-- </tr> --}}
|
||||||
<tr>
|
<tr>
|
||||||
<th>Stopień:</th>
|
<th>Stopień:</th>
|
||||||
<td>{{ $userData->rank}}</td>
|
<td>{{ $userData->rank}}</td>
|
||||||
|
@ -54,6 +54,8 @@ Route::get('/strazacy/add', 'fireFightersController@addForm');
|
|||||||
Route::post('/strazacy', 'fireFightersController@store');
|
Route::post('/strazacy', 'fireFightersController@store');
|
||||||
Route::get('/strazacy/edit/{id}', 'fireFightersController@editForm');
|
Route::get('/strazacy/edit/{id}', 'fireFightersController@editForm');
|
||||||
Route::post('/strazacy/edit', 'fireFightersController@update');
|
Route::post('/strazacy/edit', 'fireFightersController@update');
|
||||||
|
Route::post('strazacy/activate', 'fireFightersController@activate');
|
||||||
|
Route::post('strazacy/deactivate', 'fireFightersController@deactivate');
|
||||||
|
|
||||||
Route::get('/strazacy/odznaczenia/{id}', 'DecorationsController@create');
|
Route::get('/strazacy/odznaczenia/{id}', 'DecorationsController@create');
|
||||||
Route::post('/strazacy/odznaczenia/{id}', 'DecorationsController@store');
|
Route::post('/strazacy/odznaczenia/{id}', 'DecorationsController@store');
|
||||||
|
Loading…
Reference in New Issue
Block a user