First complete upload CasaDoc
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Vanguard\Support\Plugins\Dashboard\Widgets;
|
||||
|
||||
use Vanguard\Plugins\Widget;
|
||||
use Vanguard\Repositories\User\UserRepository;
|
||||
use Vanguard\Support\Enum\UserStatus;
|
||||
|
||||
class BannedUsers extends Widget
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public $width = '3';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected $permissions = 'users.manage';
|
||||
|
||||
/**
|
||||
* @var UserRepository
|
||||
*/
|
||||
protected $users;
|
||||
|
||||
/**
|
||||
* BannedUsers constructor.
|
||||
* @param UserRepository $users
|
||||
*/
|
||||
public function __construct(UserRepository $users)
|
||||
{
|
||||
$this->users = $users;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('plugins.dashboard.widgets.banned-users', [
|
||||
'count' => $this->users->countByStatus(UserStatus::BANNED)
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Vanguard\Support\Plugins\Dashboard\Widgets;
|
||||
|
||||
use Vanguard\Plugins\Widget;
|
||||
use Vanguard\Repositories\User\UserRepository;
|
||||
|
||||
class LatestRegistrations extends Widget
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public $width = '4';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected $permissions = 'users.manage';
|
||||
|
||||
/**
|
||||
* @var UserRepository
|
||||
*/
|
||||
private $users;
|
||||
|
||||
/**
|
||||
* LatestRegistrations constructor.
|
||||
* @param UserRepository $users
|
||||
*/
|
||||
public function __construct(UserRepository $users)
|
||||
{
|
||||
$this->users = $users;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('plugins.dashboard.widgets.latest-registrations', [
|
||||
'latestRegistrations' => $this->users->latest(6)
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Vanguard\Support\Plugins\Dashboard\Widgets;
|
||||
|
||||
use Vanguard\Plugins\Widget;
|
||||
use Vanguard\Repositories\User\UserRepository;
|
||||
|
||||
class NewUsers extends Widget
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public $width = '3';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected $permissions = 'users.manage';
|
||||
|
||||
/**
|
||||
* @var UserRepository
|
||||
*/
|
||||
private $users;
|
||||
|
||||
/**
|
||||
* NewUsers constructor.
|
||||
* @param UserRepository $users
|
||||
*/
|
||||
public function __construct(UserRepository $users)
|
||||
{
|
||||
$this->users = $users;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('plugins.dashboard.widgets.new-users', [
|
||||
'count' => $this->users->newUsersCount()
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace Vanguard\Support\Plugins\Dashboard\Widgets;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Vanguard\Plugins\Widget;
|
||||
use Vanguard\Repositories\User\UserRepository;
|
||||
|
||||
class RegistrationHistory extends Widget
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public $width = '8';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $permissions = 'users.manage';
|
||||
|
||||
/**
|
||||
* @var UserRepository
|
||||
*/
|
||||
private $users;
|
||||
|
||||
/**
|
||||
* @var array Count of new users per month.
|
||||
*/
|
||||
protected $usersPerMonth;
|
||||
|
||||
/**
|
||||
* RegistrationHistory constructor.
|
||||
* @param UserRepository $users
|
||||
*/
|
||||
public function __construct(UserRepository $users)
|
||||
{
|
||||
$this->users = $users;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('plugins.dashboard.widgets.registration-history', [
|
||||
'usersPerMonth' => $this->getUsersPerMonth()
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function scripts()
|
||||
{
|
||||
return view('plugins.dashboard.widgets.registration-history-scripts', [
|
||||
'usersPerMonth' => $this->getUsersPerMonth()
|
||||
]);
|
||||
}
|
||||
|
||||
private function getUsersPerMonth()
|
||||
{
|
||||
if ($this->usersPerMonth) {
|
||||
return $this->usersPerMonth;
|
||||
}
|
||||
|
||||
return $this->usersPerMonth = $this->users->countOfNewUsersPerMonth(
|
||||
Carbon::now()->subYear()->startOfMonth(),
|
||||
Carbon::now()->endOfMonth()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Vanguard\Support\Plugins\Dashboard\Widgets;
|
||||
|
||||
use Vanguard\Plugins\Widget;
|
||||
use Vanguard\Repositories\User\UserRepository;
|
||||
|
||||
class TotalUsers extends Widget
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public $width = '3';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected $permissions = 'users.manage';
|
||||
|
||||
/**
|
||||
* @var UserRepository
|
||||
*/
|
||||
private $users;
|
||||
|
||||
/**
|
||||
* TotalUsers constructor.
|
||||
* @param UserRepository $users
|
||||
*/
|
||||
public function __construct(UserRepository $users)
|
||||
{
|
||||
$this->users = $users;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('plugins.dashboard.widgets.total-users', [
|
||||
'count' => $this->users->count()
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Vanguard\Support\Plugins\Dashboard\Widgets;
|
||||
|
||||
use Vanguard\Plugins\Widget;
|
||||
use Vanguard\Repositories\User\UserRepository;
|
||||
use Vanguard\Support\Enum\UserStatus;
|
||||
|
||||
class UnconfirmedUsers extends Widget
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public $width = '3';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected $permissions = 'users.manage';
|
||||
|
||||
/**
|
||||
* @var UserRepository
|
||||
*/
|
||||
private $users;
|
||||
|
||||
/**
|
||||
* UnconfirmedUsers constructor.
|
||||
* @param UserRepository $users
|
||||
*/
|
||||
public function __construct(UserRepository $users)
|
||||
{
|
||||
$this->users = $users;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('plugins.dashboard.widgets.unconfirmed-users', [
|
||||
'count' => $this->users->countByStatus(UserStatus::UNCONFIRMED)
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Vanguard\Support\Plugins\Dashboard\Widgets;
|
||||
|
||||
use Vanguard\Plugins\Widget;
|
||||
use Vanguard\User;
|
||||
|
||||
class UserActions extends Widget
|
||||
{
|
||||
/**
|
||||
* UserActions constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->permissions(function (User $user) {
|
||||
return $user->hasRole('User');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('plugins.dashboard.widgets.user-actions');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user