1
0
forked from s421507/eOSP2
eOSP2/app/Http/Controllers/SessionsController.php
2019-09-11 00:09:22 +02:00

32 lines
609 B
PHP

<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class SessionsController extends Controller
{
public function create()
{
return view('login');
}
public function store()
{
if (auth()->attempt(request(['login', 'password'])) == false) {
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');
}
}