From 08ce25f11e668faee32ac5c1953294f44c8e2e30 Mon Sep 17 00:00:00 2001 From: AslanAV Date: Fri, 12 Jan 2024 09:56:06 +0300 Subject: [PATCH] add create.blade.php for Users --- app/Http/Controllers/UserController.php | 10 ++++- resources/views/users/create.blade.php | 50 +++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 resources/views/users/create.blade.php 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