| 123456789101112131415161718192021222324252627 |
- <?php
- namespace App\Http\Controllers;
- use Illuminate\Support\Facades\Hash;
- class ApplicationController extends Controller
- {
- public function register()
- {
- $validated = $request->validate(['login' => ['required', 'string', 'max:255'], 'full_name' => ['required', 'text', 'max:255'], 'password' => ['required', 'string'], 'phone' => ['required', 'string'], 'email' => ['required', 'string', 'max:255']]);
- User::create($validated);
- }
- public function login()
- {
- $query = User::with();
- if ($request->login()) {
- $query->where('login')->whereIn('login', $request->login)->first();
- if ($query->password === $request->password) {
- return view(route('application.index'));
- }
- return back()->withErrors('Error', "ошибка при попытке входа");
- }
- return back()->withErrors('Error', "ошибка при попытке входа");
- }
- }
|