From 3d2b32eda0a7df02024b74ef06e70e00172ba416 Mon Sep 17 00:00:00 2001 From: "iVampireSP.com" Date: Mon, 13 Feb 2023 03:06:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A8=E6=80=81=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Application/UserController.php | 2 +- app/Http/Controllers/Module/UserController.php | 2 +- app/Http/Controllers/Web/HostController.php | 2 +- app/Jobs/Host/SendRenewNotificationJob.php | 2 +- app/Jobs/Host/SuspendOverdueHosts.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/Application/UserController.php b/app/Http/Controllers/Application/UserController.php index 3249637..ec3f550 100644 --- a/app/Http/Controllers/Application/UserController.php +++ b/app/Http/Controllers/Application/UserController.php @@ -25,7 +25,7 @@ public function store(Request $request): JsonResponse 'password' => 'required|string|min:6', ]); - $user = User::create([ + $user = (new User)->create([ 'name' => $request->input('name'), 'email' => $request->input('email'), 'password' => bcrypt($request->input('password')), diff --git a/app/Http/Controllers/Module/UserController.php b/app/Http/Controllers/Module/UserController.php index 011abf6..6cb9394 100644 --- a/app/Http/Controllers/Module/UserController.php +++ b/app/Http/Controllers/Module/UserController.php @@ -48,7 +48,7 @@ public function store(Request $request): JsonResponse 'password' => 'required|string|min:6', ]); - $user = User::create([ + $user = (new User)->create([ 'name' => $request->input('name'), 'email' => $request->input('email'), 'password' => bcrypt($request->input('password')), diff --git a/app/Http/Controllers/Web/HostController.php b/app/Http/Controllers/Web/HostController.php index 8479209..73d91cf 100644 --- a/app/Http/Controllers/Web/HostController.php +++ b/app/Http/Controllers/Web/HostController.php @@ -16,7 +16,7 @@ class HostController extends Controller */ public function index(): View { - $hosts = Host::thisUser()->with(['user', 'module'])->paginate(20); + $hosts = (new Host)->thisUser()->with(['user', 'module'])->paginate(20); return view('hosts.index', compact('hosts')); } diff --git a/app/Jobs/Host/SendRenewNotificationJob.php b/app/Jobs/Host/SendRenewNotificationJob.php index e5c5cff..b770b09 100644 --- a/app/Jobs/Host/SendRenewNotificationJob.php +++ b/app/Jobs/Host/SendRenewNotificationJob.php @@ -35,7 +35,7 @@ public function handle(): void { if (! $this->host) { // 获取 Host,距离今天刚好 7 天的 Host - Host::where('next_due_at', '>', now()->addDays(7)->startOfDay()) + (new Host)->where('next_due_at', '>', now()->addDays(7)->startOfDay()) ->where('next_due_at', '<', now()->addDays(7)->endOfDay()) ->chunk(100, function ($hosts) { foreach ($hosts as $host) { diff --git a/app/Jobs/Host/SuspendOverdueHosts.php b/app/Jobs/Host/SuspendOverdueHosts.php index df1a429..8488567 100644 --- a/app/Jobs/Host/SuspendOverdueHosts.php +++ b/app/Jobs/Host/SuspendOverdueHosts.php @@ -33,7 +33,7 @@ public function __construct(?Host $host = null) public function handle(): void { if (!$this->host) { - Host::where('next_due_at', '<', now()) + (new Host)->where('next_due_at', '<', now()) ->where('status', '!=', 'suspended') ->chunk(100, function ($hosts) { foreach ($hosts as $host) {