43 lines
840 B
PHP
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');
|
||
|
}
|
||
|
}
|