forked from s421507/eOSP2
32 lines
609 B
PHP
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');
|
|
}
|
|
}
|