implement find_or_create_user

This commit is contained in:
2025-07-16 14:17:06 +03:30
parent ce1ee62d66
commit f21aca5c1b
8 changed files with 105 additions and 26 deletions
@@ -1,6 +1,6 @@
<?php
namespace Dabestaniha\AuthenticateBridge\Requests;
namespace Dabestaniha\AuthenticateBridge\App\Http\Requests;
use Dabestaniha\AuthenticateBridge\Support\Collection;
@@ -54,6 +54,7 @@ abstract class BaseFormRequest
{
return match ($rule) {
'required' => !empty($value),
'nullable' => true,
default => false,
};
}
@@ -1,19 +1,22 @@
<?php
namespace Dabestaniha\AuthenticateBridge\Requests;
namespace Dabestaniha\AuthenticateBridge\App\Http\Requests;
class DabestanihaAuthenticateRequest extends BaseFormRequest
{
public function shouldContinue(): bool
{
return $this->getRoutePath() === '/dabestaniha/login';
$path = $this->getRoutePath();
return trim($path, '/') === 'dabestaniha/login';
}
public function rules(): array
{
return [
'token' => ['required'],
'name' => ['nullable'],
'email' => ['nullable'],
];
}
}
+9
View File
@@ -7,3 +7,12 @@ if (!function_exists('view')) {
return file_get_contents("{$basedir}resources/views/$view.php");
}
}
if (!function_exists('dd')) {
function dd(): never
{
echo '<pre>';
array_map(function($arg) {var_dump($arg);}, func_get_args());
die;
}
}
+14
View File
@@ -0,0 +1,14 @@
<!-- views/invalid-token.php -->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>خطا سامانه</title>
</head>
<body>
<h1>اوه...</h1>
<p>مشکلی پیش آمده، لطفا تا دقایق دیگر دوباره امتحان کنید.</p>
<a href="<?= home_url() ?>">بازگشت به صفحه اصلی</a>
</body>
</html>