src/Http/Controllers/MicroServiceController.php
public function health()
    {
        try {
            // Logic for validating health (e.g. connections to external
            // services) should go here.

            // If a cache driver is defined, check it is working.
            if (!empty(env('CACHE_DRIVER', null))) {
                Cache::put('health_check', 'test', 1);
                Cache::get('health_check');
            }

            // If a DB connection is defined, check it is working.
            if (!empty(env('DB_HOST', null))) {
                DB::connection()->getPdo();
            }

            // All of our service dependencies are working so build a valid
            // response object.
            return $this->generateResponse('health', null);
        } catch (\Exception $e) {
            return $this->generateResponse('', null, 500, Status::FAIL, $e->getMessage());
        }
    }
public function health()
    {
        try {
            // Logic for validating health (e.g. connections to external
            // services) should go here.

            // If a cache driver is defined, check it is working.
            if (!empty(env('CACHE_DRIVER', null))) {
                Cache::put('health_check', 'test', 1);
                Cache::get('health_check');
            }

            // If a DB connection is defined, check it is working.
            if (!empty(env('DB_HOST', null))) {
                DB::connection()->getPdo();
            }

            // All of our service dependencies are working so build a valid
            // response object.
            return $this->generateResponse('health', null);
        } catch (\Exception $e) {
            return $this->generateResponse('', null, 500, Status::FAIL, $e->getMessage());
        }
    }
public function health ( ) { try { // Logic for validating health (e.g. connections to external // services) should go here. // If a cache driver is defined, check it is working. if ( ! empty ( env ( 'CACHE_DRIVER' , null ) ) ) { Cache :: put ( 'health_check' , 'test' , 1 ) ; Cache :: get ( 'health_check' ) ; } // If a DB connection is defined, check it is working. if ( ! empty ( env ( 'DB_HOST' , null ) ) ) { DB :: connection ( ) -> getPdo ( ) ; } // All of our service dependencies are working so build a valid // response object. return $ this -> generateResponse ( 'health' , null ) ; } catch ( \ Exception $ e ) { return $ this -> generateResponse ( '' , null , 500 , Status :: FAIL , $ e -> getMessage ( ) ) ; } }
Retrieve a health check for this microservice.

Required by the service gateway and load balancer.

@return Response
Retrieve a health check for this microservice .