Skip to content

Badges reputations #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions app/Console/Commands/Cleanup/DeleteOldUnverifiedUsers.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,8 @@

class DeleteOldUnverifiedUsers extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'lcm:delete-old-unverified-users';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Removed all unverified users.';

public function handle()
Expand Down
42 changes: 42 additions & 0 deletions app/Console/Commands/UpdateUserCommentsPoints.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;

class UpdateUserCommentsPoints extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'command:name';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';

/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}

/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
return 0;
}
}
25 changes: 25 additions & 0 deletions app/Console/Commands/UpdateUserDiscussionsPoints.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace App\Console\Commands;

use App\Gamify\Points\DiscussionCreated;
use App\Models\Discussion;
use Illuminate\Console\Command;

class UpdateUserDiscussionsPoints extends Command
{
protected $signature = 'lcm:update-users-discussions-points';

protected $description = 'Update users discussions reputation points';

public function handle()
{
$this->info('Updating users discussions reputations...');

foreach (Discussion::all() as $discussion) {
givePoint(new DiscussionCreated($discussion), $discussion->author);
}

$this->info('All done!');
}
}
25 changes: 25 additions & 0 deletions app/Console/Commands/UpdateUserPostsPoints.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace App\Console\Commands;

use App\Gamify\Points\PostCreated;
use App\Models\Article;
use Illuminate\Console\Command;

class UpdateUserPostsPoints extends Command
{
protected $signature = 'lcm:update-users-posts-points';

protected $description = 'Update users posts reputation points';

public function handle()
{
$this->info('Updating users posts reputations...');

foreach (Article::all() as $article) {
givePoint(new PostCreated($article), $article->author);
}

$this->info('All done!');
}
}
42 changes: 42 additions & 0 deletions app/Console/Commands/UpdateUserRepliesPoints.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;

class UpdateUserRepliesPoints extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'command:name';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';

/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}

/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
return 0;
}
}
25 changes: 25 additions & 0 deletions app/Console/Commands/UpdateUserThreadsPoints.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace App\Console\Commands;

use App\Gamify\Points\ThreadCreated;
use App\Models\Thread;
use Illuminate\Console\Command;

class UpdateUserThreadsPoints extends Command
{
protected $signature = 'lcm:update-users-threads-points';

protected $description = 'Update users threads reputation points';

public function handle()
{
$this->info('Updating users threads reputations...');

foreach (Thread::all() as $thread) {
givePoint(new ThreadCreated($thread), $thread->author);
}

$this->info('All done!');
}
}
35 changes: 35 additions & 0 deletions app/Gamify/Points/AddPhone.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace App\Gamify\Points;

use QCod\Gamify\PointType;

class AddPhone extends PointType
{
/**
* Number of points.
*
* @var int
*/
public $points = 20;

/**
* Point constructor.
*
* @param $subject
*/
public function __construct($subject)
{
$this->subject = $subject;
}

/**
* User who will be receive points.
*
* @return mixed
*/
public function payee()
{
return $this->getSubject()->user;
}
}
35 changes: 35 additions & 0 deletions app/Gamify/Points/AddSocialLinks.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace App\Gamify\Points;

use QCod\Gamify\PointType;

class AddSocialLinks extends PointType
{
/**
* Number of points.
*
* @var int
*/
public $points = 20;

/**
* Point constructor.
*
* @param $subject
*/
public function __construct($subject)
{
$this->subject = $subject;
}

/**
* User who will be receive points.
*
* @return mixed
*/
public function payee()
{
return $this->getSubject()->user;
}
}
35 changes: 35 additions & 0 deletions app/Gamify/Points/BestReply.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace App\Gamify\Points;

use QCod\Gamify\PointType;

class BestReply extends PointType
{
/**
* Number of points.
*
* @var int
*/
public $points = 20;

/**
* Point constructor.
*
* @param $subject
*/
public function __construct($subject)
{
$this->subject = $subject;
}

/**
* User who will be receive points.
*
* @return mixed
*/
public function payee()
{
return $this->getSubject()->user;
}
}
35 changes: 35 additions & 0 deletions app/Gamify/Points/CommentCreated.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace App\Gamify\Points;

use QCod\Gamify\PointType;

class CommentCreated extends PointType
{
/**
* Number of points.
*
* @var int
*/
public $points = 20;

/**
* Point constructor.
*
* @param $subject
*/
public function __construct($subject)
{
$this->subject = $subject;
}

/**
* User who will be receive points.
*
* @return mixed
*/
public function payee()
{
return $this->getSubject()->user;
}
}
20 changes: 20 additions & 0 deletions app/Gamify/Points/DiscussionCreated.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace App\Gamify\Points;

use QCod\Gamify\PointType;

class DiscussionCreated extends PointType
{
public int $points = 10;

public function __construct($subject)
{
$this->subject = $subject;
}

public function payee()
{
return $this->getSubject()->author;
}
}
20 changes: 20 additions & 0 deletions app/Gamify/Points/PostCreated.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace App\Gamify\Points;

use QCod\Gamify\PointType;

class PostCreated extends PointType
{
public int $points = 10;

public function __construct($subject)
{
$this->subject = $subject;
}

public function payee()
{
return $this->getSubject()->author;
}
}
Loading