Files
UNIT3D-Community-Edition/app/Traits/UsersOnlineTrait.php
HDVinnie 78608a4666 refactor: space after sole ! operators
-  There should be a space after sole `!` operators
2020-04-14 22:31:48 -04:00

32 lines
736 B
PHP

<?php
/**
* NOTICE OF LICENSE.
*
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0
* The details is bundled with this project in the file LICENSE.txt.
*
* @project UNIT3D Community Edition
*
* @author HDVinnie <hdinnovations@protonmail.com>
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
*/
namespace App\Traits;
trait UsersOnlineTrait
{
/**
* Check if the current user is online.
*
* @return bool
*/
public function isOnline()
{
if (! $this->last_action) {
return false;
}
return $this->last_action->gt(now()->subMinutes(5));
}
}