mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-29 09:43:16 +00:00
Merge pull request #1298 from pixelfed/frontend-ui-refactor
Update command
This commit is contained in:
commit
56d61bc074
1 changed files with 13 additions and 8 deletions
|
@ -40,19 +40,24 @@ class SeedFollows extends Command
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$limit = 10000;
|
$limit = 100;
|
||||||
|
|
||||||
for ($i = 0; $i < $limit; $i++) {
|
for ($i = 0; $i < $limit; $i++) {
|
||||||
try {
|
try {
|
||||||
$actor = Profile::inRandomOrder()->firstOrFail();
|
$actor = Profile::whereDomain(false)->inRandomOrder()->firstOrFail();
|
||||||
$target = Profile::inRandomOrder()->firstOrFail();
|
$target = Profile::whereDomain(false)->inRandomOrder()->firstOrFail();
|
||||||
|
|
||||||
$follow = new Follower();
|
if($actor->id == $target->id) {
|
||||||
$follow->profile_id = $actor->id;
|
continue;
|
||||||
$follow->following_id = $target->id;
|
}
|
||||||
$follow->save();
|
|
||||||
|
|
||||||
|
$follow = Follower::firstOrCreate([
|
||||||
|
'profile_id' => $actor->id,
|
||||||
|
'following_id' => $target->id
|
||||||
|
]);
|
||||||
|
if($follow->wasRecentlyCreated == true) {
|
||||||
FollowPipeline::dispatch($follow);
|
FollowPipeline::dispatch($follow);
|
||||||
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue