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()
{
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');
}
}