1<?php
2
3// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
4// See the LICENCE file in the repository root for full licence text.
5
6namespace App\Jobs;
7
8use App\Models\User;
9use Illuminate\Bus\Queueable;
10use Illuminate\Contracts\Queue\ShouldQueue;
11use Illuminate\Queue\InteractsWithQueue;
12
13class UpdateUserFollowerCountCache implements ShouldQueue
14{
15 use InteractsWithQueue, Queueable;
16
17 protected $userId;
18
19 /**
20 * Create a new job instance.
21 *
22 * @return void
23 */
24 public function __construct($userId)
25 {
26 $this->userId = $userId;
27 }
28
29 /**
30 * Execute the job.
31 *
32 * @return void
33 */
34 public function handle()
35 {
36 User::find($this->userId)->cacheFollowerCount();
37 }
38}