30 lines
717 B
PHP
30 lines
717 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Response;
|
|
use Illuminate\Routing\Controller;
|
|
use Laravel\Sanctum\PersonalAccessToken;
|
|
|
|
class FuncController extends Controller
|
|
{
|
|
public static function check_user()
|
|
{
|
|
if (isset($_COOKIE['mm_token']) && !empty($_COOKIE['mm_token'])) {
|
|
abort(Response::HTTP_NOT_FOUND);
|
|
}
|
|
}
|
|
|
|
public static function get_profile()
|
|
{
|
|
if (isset($_COOKIE['mm_token']) && !empty($_COOKIE['mm_token'])) {
|
|
$token = PersonalAccessToken::findToken($_COOKIE['mm_token']);
|
|
|
|
return $token->tokenable;
|
|
} else {
|
|
abort(Response::HTTP_NOT_FOUND);
|
|
}
|
|
}
|
|
}
|