2021-03-09 12:29:49 +00:00
|
|
|
<?php
|
2021-03-09 13:43:39 +00:00
|
|
|
require_once "../../../bootstrap.php";
|
2021-03-09 12:29:49 +00:00
|
|
|
|
|
|
|
use Backend\Models\Group;
|
|
|
|
use Backend\Models\Password;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $token
|
|
|
|
* @return Group;
|
|
|
|
*/
|
|
|
|
|
|
|
|
function groupViaToken(string $token){
|
|
|
|
|
2021-03-09 13:43:39 +00:00
|
|
|
if($password = Password::firstWhere('remember_token', $token)){
|
|
|
|
return Group::find($password->group_id);
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
function isLogin(){
|
|
|
|
return isset($_SESSION["token"]);
|
2021-03-09 12:29:49 +00:00
|
|
|
}
|