for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Created by PhpStorm.
* User: afshin
* Date: 11/24/17
* Time: 1:11 PM
*/
namespace Core\Services;
use App\DataAccess\User\UserDataAccess;
use Core\Interfaces\_Service;
class AuthService extends _Service
{
public function user()
return UserDataAccess::getUserById(isset($_SESSION['userid']) ? $_SESSION['userid'] : 0);
}
public function check()
return isset($_SESSION['user']);
public function attempt(string $username,string $password)
$user = UserDataAccess::getUserLoginField($username)->first();
if (!$user) {
return false;
if (password_verify($password,$user->password)) {
password
App\Model\User
Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.
$_SESSION['user'] = $user->id;
return true;
public function logout()
unset($_SESSION['user']);
Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.