diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 495fd26..63add16 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -17,7 +17,7 @@ class UserController extends Controller public function store($request) { if (Auth::guest()) { - return redirect()->route('tasks.index'); + abort(403, 'Вы не авторизованы!'); } $validated = $request->validated(); @@ -35,4 +35,12 @@ class UserController extends Controller $message = __('controllers.tasks_create'); return redirect()->route('tasks.index'); } + + public function create() + { + if (Auth::guest()) { + abort(403, 'Вы не авторизованы!'); + } + return view('users.create'); + } } diff --git a/resources/views/users/create.blade.php b/resources/views/users/create.blade.php new file mode 100644 index 0000000..3347bdc --- /dev/null +++ b/resources/views/users/create.blade.php @@ -0,0 +1,50 @@ +@auth() +
+

создать + пользователя

+ + {{ Form::open(['url' => route('users.store'), 'method' => 'POST', 'class' => 'w-50']) }} +
+
+ {{ Form::label('name', 'Логин') }} +
+
+ {{ Form::text('name', '', ['class' => 'form-control rounded border-gray-300 w-1/3']) }} +
+
+ @if ($errors->any()) + {{ $errors->first('name') }} + @endif +
+ +
+ {{ Form::label('email', 'электронная почта') }} +
+
+ {{ Form::text('email', '', ['class' => 'form-control rounded border-gray-300 w-1/3']) }} +
+
+ @if ($errors->any()) + {{ $errors->first('email') }} + @endif +
+ +
+ {{ Form::label('password', 'Пароль') }} +
+
+ {{ Form::text('password', '', ['class' => 'form-control rounded border-gray-300 w-1/3']) }} +
+
+ @if ($errors->any()) + {{ $errors->first('password') }} + @endif +
+ +
+ {{ Form::submit('создать', ['class' => 'bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded']) }} +
+
+ {{ Form::close() }} +
+@endauth