public function make(string $serviceId, array $arguments = null)
    {
        $service   = self::$services[$serviceId];
        $arguments = $service->getDefaults() ?? $arguments;

        // Dispatch before make event
        $this->app->events()->trigger(
            ServiceMake::class,
            [$serviceId, $service, $arguments]
        );

        // Make the object by dispatching the service
        $made =
            $this->app->dispatcher()->dispatchCallable($service, $arguments);

        // Dispatch after make event
        $this->app->events()->trigger(ServiceMade::class, [$serviceId, $made]);

        // If the service is a singleton
        if ($service->isSingleton()) {
            $this->app->events()->trigger(
                ServiceMadeSingleton::class,
                [$serviceId, $made]
            );
            // Set singleton
            $this->singleton($serviceId, $made);
        }

        return $made;
    }
public function make(string $serviceId, array $arguments = null)
    {
        $service   = self::$services[$serviceId];
        $arguments = $service->getDefaults() ?? $arguments;

        // Dispatch before make event
        $this->app->events()->trigger(
            ServiceMake::class,
            [$serviceId, $service, $arguments]
        );

        // Make the object by dispatching the service
        $made =
            $this->app->dispatcher()->dispatchCallable($service, $arguments);

        // Dispatch after make event
        $this->app->events()->trigger(ServiceMade::class, [$serviceId, $made]);

        // If the service is a singleton
        if ($service->isSingleton()) {
            $this->app->events()->trigger(
                ServiceMadeSingleton::class,
                [$serviceId, $made]
            );
            // Set singleton
            $this->singleton($serviceId, $made);
        }

        return $made;
    }
public function make ( string $ serviceId , array $ arguments = null ) { $ service = self :: $ services [ $ serviceId ] ; $ arguments = $ service -> getDefaults ( ) ?? $ arguments ; // Dispatch before make event $ this -> app -> events ( ) -> trigger ( ServiceMake :: class , [ $ serviceId , $ service , $ arguments ] ) ; // Make the object by dispatching the service $ made = $ this -> app -> dispatcher ( ) -> dispatchCallable ( $ service , $ arguments ) ; // Dispatch after make event $ this -> app -> events ( ) -> trigger ( ServiceMade :: class , [ $ serviceId , $ made ] ) ; // If the service is a singleton if ( $ service -> isSingleton ( ) ) { $ this -> app -> events ( ) -> trigger ( ServiceMadeSingleton :: class , [ $ serviceId , $ made ] ) ; // Set singleton $ this -> singleton ( $ serviceId , $ made ) ; } return $ made ; }
Make a service.

@param string     $serviceId The service id
@param array|null $arguments [optional] The arguments

@return mixed
Make a service .