File size: 525 Bytes
5f32fbd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php

namespace App\Services;

use Spatie\Health\Checks\Check;
use Spatie\Health\Checks\Result;

class MemoryLimit extends Check
{
    public function run(): Result
    {
        $memoryLimit = getServerMemoryLimit();

        $result = \Spatie\Health\Checks\Result::make();

        if ($memoryLimit == -1) {
            return $result->ok(__('Unlimited'));
        }

        if ($memoryLimit < 64) {
            return $result->failed("{$memoryLimit}M");
        }

        return $result->ok("{$memoryLimit}M");
    }
}