eOSP2/app/Http/Controllers/SessionsController.php

32 lines
609 B
PHP
Raw Normal View History

2019-09-11 00:09:22 +02:00
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class SessionsController extends Controller
{
public function create()
{
return view('login');
}
public function store()
{
2019-09-17 19:59:20 +02:00
if (auth()->attempt(request(['email', 'password'])) == false) {
2019-09-11 00:09:22 +02:00
return back()->withErrors([
'message' => 'The email or password is incorrect, please try again'
]);
}
return redirect()->to('/jednostka');
}
public function destroy()
{
auth()->logout();
return redirect()->to('/login');
}
}