ability to download log from admin

This commit is contained in:
Čarodej
2022-03-08 10:51:32 +01:00
parent 4e2155b75a
commit dd1f3b299d
52 changed files with 182 additions and 46 deletions
+25
View File
@@ -0,0 +1,25 @@
<?php
namespace Support\Middleware;
use Closure;
class AdminCheck
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
// Check if user have access to administration settings
if ( $request->user()->role !== 'admin') {
abort(403, 'You don\'t have access for this operation!');
}
return $next($request);
}
}
+16
View File
@@ -18,6 +18,22 @@ use Domain\Localization\Models\Language;
use Intervention\Image\ImageManagerStatic as Image;
use Illuminate\Database\Eloquent\ModelNotFoundException;
if (! function_exists('getListOfLatestLogs')) {
/**
* Check if cron is running
*/
function getListOfLatestLogs(): array
{
return array_slice(
array_reverse(
array_filter(
scandir(storage_path() . '/logs'), fn($fn) => !str_starts_with($fn, '.')
)
), 0, 5, true
);
}
}
if (! function_exists('isRunningCron')) {
/**
* Check if cron is running