Skip to content

Commit

Permalink
Merge pull request #2100 from LuckyCyborg/4.0
Browse files Browse the repository at this point in the history
Overall improvements
  • Loading branch information
LuckyCyborg authored Aug 11, 2018
2 parents bc24ffa + 1170913 commit 2deb761
Show file tree
Hide file tree
Showing 13 changed files with 579 additions and 322 deletions.
1 change: 1 addition & 0 deletions app/Config/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
'Shared\Auth\AuthServiceProvider',
'Shared\Backup\BackupServiceProvider',
'Shared\Cache\CacheServiceProvider',
'Shared\DataTable\DataTableServiceProvider',
'Shared\DomPDF\PdfServiceProvider',
'Shared\Queue\QueueServiceProvider',
'Shared\Routing\RoutingServiceProvider',
Expand Down
2 changes: 1 addition & 1 deletion app/Platform/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// Define The Application Version
//--------------------------------------------------------------------------

define('VERSION', '4.0.80');
define('VERSION', '4.0.81');

//--------------------------------------------------------------------------
// Set PHP Error Reporting Options
Expand Down
55 changes: 26 additions & 29 deletions modules/Users/Controllers/Admin/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
use Nova\Support\Arr;
use Nova\Support\Str;

use Shared\Support\DataTable;
use Shared\Support\Facades\DataTable;

use Modules\Platform\Controllers\Admin\BaseController;
use Modules\Roles\Models\Role;
Expand Down Expand Up @@ -149,37 +149,34 @@ protected function validator(array $data, Collection $items, $id = null)

public function data(Request $request)
{
$columns = array(
array('data' => 'id', 'name' => 'id'),
array('data' => 'username', 'name' => 'username'),
array('data' => 'realname', 'name' => 'realname'),
array('data' => 'email', 'name' => 'email'),

array('data' => 'roles', 'name' => 'roles.name', 'uses' => function ($user)
{
$roles = $user->roles->lists('name');

return implode(', ', $roles);
}),

array('data' => 'created_at', 'name' => 'created_at', 'uses' => function ($user)
{
$format = __d('users', '%d %b %Y, %H:%M');

return $user->created_at->formatLocalized($format);
}),

array('data' => 'actions', 'name' => 'actions', 'uses' => function ($user)
{
return View::fetch('Modules/Users::Partials/UsersTableActions', compact('user'));
}),
);

$query = User::with('roles')->where('activated', 1);

$data = DataTable::handle($query, $request, $columns);
$dataTable = DataTable::make($query)
->column('id')
->column('username')
->column('realname')
->column('email');

$dataTable->column('roles', 'roles.name', function ($user)
{
$roles = $user->roles->lists('name');

return implode(', ', $roles);
});

$dataTable->column('created_at', function ($user)
{
$format = __d('users', '%d %b %Y, %H:%M');

return $user->created_at->formatLocalized($format);
});

$dataTable->column('actions', function ($user)
{
return View::fetch('Modules/Users::Partials/UsersTableActions', compact('user'));
});

return Response::json($data);
return $dataTable->handle($request);
}

public function index()
Expand Down
4 changes: 2 additions & 2 deletions shared/Auth/AuthServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ class AuthServiceProvider extends ServiceProvider
*/
public function register()
{
$this->app->bindShared('command.auth.reminders', function($app)
$this->app->singleton('command.auth.reminders', function($app)
{
return new RemindersTableCommand($app['files']);
});

$this->app->bindShared('command.auth.reminders.clear', function()
$this->app->singleton('command.auth.reminders.clear', function()
{
return new ClearRemindersCommand;
});
Expand Down
7 changes: 7 additions & 0 deletions shared/Cache/CacheServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@

class CacheServiceProvider extends ServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = true;


/**
* Bootstrap the application services.
Expand Down
Loading

0 comments on commit 2deb761

Please sign in to comment.