Merge branch 'user_management' into dev
This commit is contained in:
@@ -66,6 +66,6 @@ class UserManagement extends Controller
|
|||||||
// refresh page with information about successfull registration
|
// refresh page with information about successfull registration
|
||||||
return redirect()
|
return redirect()
|
||||||
->route('users.new')
|
->route('users.new')
|
||||||
->with('message', trans('admin/userManagement.registrationSuccessfull'));
|
->with('success', trans('admin/userManagement.registrationSuccessfull'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,17 +7,6 @@ use App\Models\User;
|
|||||||
|
|
||||||
class CreateNewUserRequest extends Request
|
class CreateNewUserRequest extends Request
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Determine if the user is authorized to make this request.
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function authorize()
|
|
||||||
{
|
|
||||||
|
|
||||||
return \Auth::check() && \Auth::$user->role == User::ROLE_ADMIN;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -6,5 +6,14 @@ use Illuminate\Foundation\Http\FormRequest;
|
|||||||
|
|
||||||
abstract class Request extends FormRequest
|
abstract class Request extends FormRequest
|
||||||
{
|
{
|
||||||
//
|
/**
|
||||||
|
* Determine if the user is authorized to make this request.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function authorize()
|
||||||
|
{
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
'addNewUser' => 'Add new user',
|
||||||
'name' => 'Full name',
|
'name' => 'Full name',
|
||||||
'email' => 'Email',
|
'email' => 'Email',
|
||||||
'password' => 'Password',
|
'password' => 'Password',
|
||||||
|
|||||||
@@ -1,6 +1,21 @@
|
|||||||
@extends('admin.layout')
|
@extends('admin.layout')
|
||||||
|
|
||||||
|
@section('pageName', @trans('admin/userManagement.addNewUser'))
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
|
@if (session('success'))
|
||||||
|
<div class="callout success">
|
||||||
|
{{ session('success') }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if (session('error'))
|
||||||
|
<div class="callout alert">
|
||||||
|
{{ session('error') }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
<form method="POST" action="{{route('users.newPost')}}">
|
<form method="POST" action="{{route('users.newPost')}}">
|
||||||
{!! csrf_field() !!}
|
{!! csrf_field() !!}
|
||||||
|
|
||||||
@@ -15,9 +30,9 @@
|
|||||||
<input type="text" name="email" placeholder="somebody@example.com">
|
<input type="text" name="email" placeholder="somebody@example.com">
|
||||||
|
|
||||||
@if (isset($errors) && $errors->has('email'))
|
@if (isset($errors) && $errors->has('email'))
|
||||||
<span class="help-block">
|
<div class="callout alert">
|
||||||
<strong>{{ $errors->first('email') }}</strong>
|
{{ $errors->first('email') }}
|
||||||
</span>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
@@ -27,35 +42,32 @@
|
|||||||
<input type="text" name="password">
|
<input type="text" name="password">
|
||||||
|
|
||||||
@if (isset($errors) && $errors->has('password'))
|
@if (isset($errors) && $errors->has('password'))
|
||||||
<span class="help-block">
|
<div class="callout alert">
|
||||||
<strong>{{ $errors->first('password') }}</strong>
|
{{ $errors->first('password') }}
|
||||||
</span>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<div>
|
|
||||||
@lang('admin/userManagement.roles')
|
|
||||||
|
|
||||||
@foreach($roles as $role => $translation)
|
|
||||||
<label>
|
|
||||||
@lang($translation)
|
|
||||||
<input type="radio" name="role" value="{{$role}}">
|
|
||||||
</label>
|
|
||||||
@endforeach
|
|
||||||
|
|
||||||
|
|
||||||
@if (isset($errors) && $errors->has('role'))
|
|
||||||
<span class="help-block">
|
|
||||||
<strong>{{ $errors->first('role') }}</strong>
|
|
||||||
</span>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
<input type="submit" value="@lang('admin/userManagement.register')">
|
@lang('admin/userManagement.roles')
|
||||||
|
|
||||||
|
<select name="role">
|
||||||
|
@foreach($roles as $role => $translation)
|
||||||
|
<option value="{{$role}}">@lang($translation)</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
|
||||||
|
@if (isset($errors) && $errors->has('role'))
|
||||||
|
<div class="callout alert">
|
||||||
|
{{ $errors->first('role') }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<label>
|
||||||
|
<button type="submit" class="button success">@lang('admin/userManagement.register')</button>
|
||||||
</label>
|
</label>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@stop
|
@stop
|
||||||
Reference in New Issue
Block a user