Skip to content

Commit

Permalink
Merge branch '3.x' into wip/floor-plan
Browse files Browse the repository at this point in the history
# Conflicts:
#	app/admin/models/Reservations_model.php
  • Loading branch information
sampoyigi committed Aug 15, 2023
2 parents a0d85d2 + cf3403c commit 137cbcd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function up()
->value('value');

$widgets = collect(json_decode($widgets, true))->mapWithKeys(function ($properties, $alias) {
if ($options = array_get($this->widgetsMap, array_pull($properties, 'class'))) {
if ($options = array_get($this->widgetsMap, array_pull($properties, 'class', ''))) {
$properties['widget'] = $options[0];

$props = array_pull($properties, 'config');
Expand Down
17 changes: 10 additions & 7 deletions app/admin/middleware/LogUserLastSeen.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Admin\Middleware;

use Admin\Facades\AdminAuth;
use Carbon\Carbon;
use Closure;
use Illuminate\Support\Facades\App;
Expand All @@ -12,12 +11,16 @@ class LogUserLastSeen
{
public function handle($request, Closure $next)
{
if (App::hasDatabase() && AdminAuth::check()) {
$cacheKey = 'is-online-user-'.AdminAuth::getId();
$expireAt = Carbon::now()->addMinutes(2);
Cache::remember($cacheKey, $expireAt, function () {
return AdminAuth::user()->updateLastSeen(Carbon::now()->addMinutes(5));
});
if (App::hasDatabase()) {
foreach (['admin.auth', 'auth'] as $authService) {
if (App::hasDatabase() && resolve($authService)->check()) {
$cacheKey = 'is-online-'.str_replace('.', '-', $authService).'-user-'.resolve($authService)->getId();
$expireAt = Carbon::now()->addMinutes(2);
Cache::remember($cacheKey, $expireAt, function () use ($authService) {
return resolve($authService)->user()->updateLastSeen(Carbon::now());
});
}
}
}

return $next($request);
Expand Down

0 comments on commit 137cbcd

Please sign in to comment.