格式化代码
This commit is contained in:
parent
971c649f31
commit
cdabfedeb6
@ -20,7 +20,7 @@ class Init extends Command
|
||||
*/
|
||||
protected $description = '初始化应用程序(用于容器启动时)。';
|
||||
|
||||
/**
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle(): void
|
||||
|
@ -2,12 +2,12 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Services\PingerService;
|
||||
use Spiral\RoadRunner\Worker;
|
||||
use Illuminate\Console\Command;
|
||||
use Spiral\RoadRunner\GRPC\Server;
|
||||
use Spiral\RoadRunner\GRPC\Invoker;
|
||||
use App\Services\gRPC\Pinger\PingerInterface;
|
||||
use App\Services\PingerService;
|
||||
use Illuminate\Console\Command;
|
||||
use Spiral\RoadRunner\GRPC\Invoker;
|
||||
use Spiral\RoadRunner\GRPC\Server;
|
||||
use Spiral\RoadRunner\Worker;
|
||||
|
||||
class Works extends Command
|
||||
{
|
||||
|
@ -20,7 +20,7 @@ protected function schedule(Schedule $schedule): void
|
||||
*/
|
||||
protected function commands(): void
|
||||
{
|
||||
$this->load(__DIR__.'/Commands');
|
||||
$this->load(__DIR__ . '/Commands');
|
||||
|
||||
require base_path('routes/console.php');
|
||||
}
|
||||
|
@ -4,17 +4,16 @@
|
||||
|
||||
use App\Models\User;
|
||||
use GuzzleHttp\Client;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class AuthController extends Controller
|
||||
{
|
||||
private $redirectTo = '/';
|
||||
|
||||
|
||||
public function redirect(Request $request)
|
||||
{
|
||||
$request->session()->put('state', $state = Str::random(40));
|
||||
|
@ -2,7 +2,30 @@
|
||||
|
||||
namespace App\Http;
|
||||
|
||||
use App\Http\Middleware\Authenticate;
|
||||
use App\Http\Middleware\EncryptCookies;
|
||||
use App\Http\Middleware\PreventRequestsDuringMaintenance;
|
||||
use App\Http\Middleware\RedirectIfAuthenticated;
|
||||
use App\Http\Middleware\TrimStrings;
|
||||
use App\Http\Middleware\TrustProxies;
|
||||
use App\Http\Middleware\ValidateSignature;
|
||||
use App\Http\Middleware\VerifyCsrfToken;
|
||||
use Illuminate\Auth\Middleware\AuthenticateWithBasicAuth;
|
||||
use Illuminate\Auth\Middleware\Authorize;
|
||||
use Illuminate\Auth\Middleware\EnsureEmailIsVerified;
|
||||
use Illuminate\Auth\Middleware\RequirePassword;
|
||||
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
|
||||
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||
use Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull;
|
||||
use Illuminate\Foundation\Http\Middleware\HandlePrecognitiveRequests;
|
||||
use Illuminate\Foundation\Http\Middleware\ValidatePostSize;
|
||||
use Illuminate\Http\Middleware\HandleCors;
|
||||
use Illuminate\Http\Middleware\SetCacheHeaders;
|
||||
use Illuminate\Routing\Middleware\SubstituteBindings;
|
||||
use Illuminate\Routing\Middleware\ThrottleRequests;
|
||||
use Illuminate\Session\Middleware\AuthenticateSession;
|
||||
use Illuminate\Session\Middleware\StartSession;
|
||||
use Illuminate\View\Middleware\ShareErrorsFromSession;
|
||||
|
||||
class Kernel extends HttpKernel
|
||||
{
|
||||
@ -15,12 +38,12 @@ class Kernel extends HttpKernel
|
||||
*/
|
||||
protected $middleware = [
|
||||
// \App\Http\Middleware\TrustHosts::class,
|
||||
\App\Http\Middleware\TrustProxies::class,
|
||||
\Illuminate\Http\Middleware\HandleCors::class,
|
||||
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||
\App\Http\Middleware\TrimStrings::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
||||
TrustProxies::class,
|
||||
HandleCors::class,
|
||||
PreventRequestsDuringMaintenance::class,
|
||||
ValidatePostSize::class,
|
||||
TrimStrings::class,
|
||||
ConvertEmptyStringsToNull::class,
|
||||
];
|
||||
|
||||
/**
|
||||
@ -30,18 +53,18 @@ class Kernel extends HttpKernel
|
||||
*/
|
||||
protected $middlewareGroups = [
|
||||
'web' => [
|
||||
\App\Http\Middleware\EncryptCookies::class,
|
||||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
EncryptCookies::class,
|
||||
AddQueuedCookiesToResponse::class,
|
||||
StartSession::class,
|
||||
ShareErrorsFromSession::class,
|
||||
VerifyCsrfToken::class,
|
||||
SubstituteBindings::class,
|
||||
],
|
||||
|
||||
'api' => [
|
||||
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
||||
\Illuminate\Routing\Middleware\ThrottleRequests::class.':api',
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
ThrottleRequests::class . ':api',
|
||||
SubstituteBindings::class,
|
||||
],
|
||||
];
|
||||
|
||||
@ -53,16 +76,16 @@ class Kernel extends HttpKernel
|
||||
* @var array<string, class-string|string>
|
||||
*/
|
||||
protected $middlewareAliases = [
|
||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
||||
'precognitive' => \Illuminate\Foundation\Http\Middleware\HandlePrecognitiveRequests::class,
|
||||
'signed' => \App\Http\Middleware\ValidateSignature::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
||||
'auth' => Authenticate::class,
|
||||
'auth.basic' => AuthenticateWithBasicAuth::class,
|
||||
'auth.session' => AuthenticateSession::class,
|
||||
'cache.headers' => SetCacheHeaders::class,
|
||||
'can' => Authorize::class,
|
||||
'guest' => RedirectIfAuthenticated::class,
|
||||
'password.confirm' => RequirePassword::class,
|
||||
'precognitive' => HandlePrecognitiveRequests::class,
|
||||
'signed' => ValidateSignature::class,
|
||||
'throttle' => ThrottleRequests::class,
|
||||
'verified' => EnsureEmailIsVerified::class,
|
||||
];
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ class RedirectIfAuthenticated
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||
* @param Closure(Request): (Response) $next
|
||||
*/
|
||||
public function handle(Request $request, Closure $next, string ...$guards): Response
|
||||
{
|
||||
|
@ -5,7 +5,6 @@
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
@ -2,19 +2,18 @@
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use Spiral\RoadRunner\GRPC;
|
||||
use App\Services\gRPC\Pinger\PingerInterface;
|
||||
use App\Services\gRPC\Pinger\PingRequest;
|
||||
use App\Services\gRPC\Pinger\PingResponse;
|
||||
use App\Services\gRPC\Pinger\PingerInterface;
|
||||
use Spiral\RoadRunner\GRPC\ContextInterface;
|
||||
|
||||
class PingerService implements PingerInterface
|
||||
{
|
||||
public function ping(ContextInterface $ctx, PingRequest $in): PingResponse
|
||||
{
|
||||
{
|
||||
|
||||
return new PingResponse([
|
||||
'status_code' => rand(200, 500)
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
@ -4,14 +4,14 @@
|
||||
|
||||
namespace App\Services\gRPC\Pinger;
|
||||
|
||||
use Google\Protobuf\Internal\GPBType;
|
||||
use Google\Protobuf\Internal\RepeatedField;
|
||||
use App\Services\gRPC\GPBMetadata\Pinger;
|
||||
use Google\Protobuf\Internal\GPBUtil;
|
||||
use Google\Protobuf\Internal\Message;
|
||||
|
||||
/**
|
||||
* Generated from protobuf message <code>pinger.PingRequest</code>
|
||||
*/
|
||||
class PingRequest extends \Google\Protobuf\Internal\Message
|
||||
class PingRequest extends Message
|
||||
{
|
||||
/**
|
||||
* Generated from protobuf field <code>string url = 1;</code>
|
||||
@ -22,18 +22,20 @@ class PingRequest extends \Google\Protobuf\Internal\Message
|
||||
* Constructor.
|
||||
*
|
||||
* @param array $data {
|
||||
* Optional. Data for populating the Message object.
|
||||
* Optional. Data for populating the Message object.
|
||||
*
|
||||
* @type string $url
|
||||
* }
|
||||
* @type string $url
|
||||
* }
|
||||
*/
|
||||
public function __construct($data = NULL) {
|
||||
\App\Services\gRPC\GPBMetadata\Pinger::initOnce();
|
||||
public function __construct($data = null)
|
||||
{
|
||||
Pinger::initOnce();
|
||||
parent::__construct($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generated from protobuf field <code>string url = 1;</code>
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUrl()
|
||||
@ -43,12 +45,14 @@ public function getUrl()
|
||||
|
||||
/**
|
||||
* Generated from protobuf field <code>string url = 1;</code>
|
||||
*
|
||||
* @param string $var
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setUrl($var)
|
||||
{
|
||||
GPBUtil::checkString($var, True);
|
||||
GPBUtil::checkString($var, true);
|
||||
$this->url = $var;
|
||||
|
||||
return $this;
|
||||
|
@ -4,14 +4,14 @@
|
||||
|
||||
namespace App\Services\gRPC\Pinger;
|
||||
|
||||
use Google\Protobuf\Internal\GPBType;
|
||||
use Google\Protobuf\Internal\RepeatedField;
|
||||
use App\Services\gRPC\GPBMetadata\Pinger;
|
||||
use Google\Protobuf\Internal\GPBUtil;
|
||||
use Google\Protobuf\Internal\Message;
|
||||
|
||||
/**
|
||||
* Generated from protobuf message <code>pinger.PingResponse</code>
|
||||
*/
|
||||
class PingResponse extends \Google\Protobuf\Internal\Message
|
||||
class PingResponse extends Message
|
||||
{
|
||||
/**
|
||||
* Generated from protobuf field <code>int32 status_code = 1;</code>
|
||||
@ -22,18 +22,20 @@ class PingResponse extends \Google\Protobuf\Internal\Message
|
||||
* Constructor.
|
||||
*
|
||||
* @param array $data {
|
||||
* Optional. Data for populating the Message object.
|
||||
* Optional. Data for populating the Message object.
|
||||
*
|
||||
* @type int $status_code
|
||||
* }
|
||||
* @type int $status_code
|
||||
* }
|
||||
*/
|
||||
public function __construct($data = NULL) {
|
||||
\App\Services\gRPC\GPBMetadata\Pinger::initOnce();
|
||||
public function __construct($data = null)
|
||||
{
|
||||
Pinger::initOnce();
|
||||
parent::__construct($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generated from protobuf field <code>int32 status_code = 1;</code>
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getStatusCode()
|
||||
@ -43,7 +45,9 @@ public function getStatusCode()
|
||||
|
||||
/**
|
||||
* Generated from protobuf field <code>int32 status_code = 1;</code>
|
||||
*
|
||||
* @param int $var
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setStatusCode($var)
|
||||
|
@ -12,11 +12,12 @@ interface PingerInterface extends GRPC\ServiceInterface
|
||||
public const NAME = "pinger.Pinger";
|
||||
|
||||
/**
|
||||
* @param GRPC\ContextInterface $ctx
|
||||
* @param PingRequest $in
|
||||
* @return PingResponse
|
||||
*
|
||||
* @throws GRPC\Exception\InvokeException
|
||||
*/
|
||||
* @param GRPC\ContextInterface $ctx
|
||||
* @param PingRequest $in
|
||||
*
|
||||
* @return PingResponse
|
||||
*
|
||||
* @throws GRPC\Exception\InvokeException
|
||||
*/
|
||||
public function ping(GRPC\ContextInterface $ctx, PingRequest $in): PingResponse;
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
},
|
||||
"require-dev": {
|
||||
"fakerphp/faker": "^1.9.1",
|
||||
"laravel/pint": "^1.0",
|
||||
"laravel/pint": "^1.13",
|
||||
"laravel/sail": "^1.18",
|
||||
"mockery/mockery": "^1.4.4",
|
||||
"nunomaduro/collision": "^7.0",
|
||||
|
2
composer.lock
generated
2
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "49bbf2a7ce94713296cca9ba67ed46f2",
|
||||
"content-hash": "52aa47f1f069d6f6969dfb7089ae1adf",
|
||||
"packages": [
|
||||
{
|
||||
"name": "brick/math",
|
||||
|
Loading…
Reference in New Issue
Block a user