1
0
forked from s421507/eOSP2
eOSP2/app/Http/Controllers/LogowanieController.php
2019-07-11 23:55:51 +02:00

43 lines
840 B
PHP

<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Uzytkownik;
use Validator;
use Auth;
class LogowanieController extends Controller
{
public function showLogin()
{
echo 'show';
return view('documents');
}
public function doLogin()
{
$this->validate(request(), [
'userLogin' => 'required',
'userPassword' => 'required'
]);
$request = request();
$credentials = $request->only('login', 'password');
$Uzytkownik = array(
'Login' => $request-> userLogin,
'Password' => $request-> userPassword
);
if(Auth::attempt($credentials)){
echo Auth::Uzytkownik()->email;
} else{
echo 'blad';
}
#return view( 'documents');
}
}