动态调用
This commit is contained in:
parent
cf638fddb4
commit
3d2b32eda0
@ -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')),
|
||||
|
@ -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')),
|
||||
|
@ -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'));
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user