The with function returns the value it is given. If a closure is passed as the second argument to the function, the closure will be executed and its returned value will be returned:
<?php $callback = function ($value) {
    return (is_numeric($value)) ? $value * 2 : 0;
};

$result = with(5, $callback);


$result = with(null, $callback);


$result = with(5, null);
<?php         }



        if ($event->sandbox->resolved('auth')) {

            with($event->sandbox->make('auth'), function ($auth) use ($event) {

                $auth->setApplication($event->sandbox);

                $auth->forgetGuards();

            });

        }

    }

}
<?php             return;

        }



        with($event->sandbox->make(BroadcastManager::class), function ($manager) use ($event) {

            $manager->setApplication($event->sandbox);





        });

    }

}
<?php             return;

        }



        with($event->sandbox->make('db'), function ($manager) use ($event) {

            $manager->setApplication($event->sandbox);

        });

    }

}
<?php             return;

        }



        with($event->sandbox->make('mail.manager'), function ($manager) use ($event) {

            $manager->setApplication($event->sandbox);

            $manager->forgetMailers();

        });

    }

}
<?php             return;

        }



        with($event->sandbox->make(ChannelManager::class), function ($manager) use ($event) {

            $manager->setContainer($event->sandbox);

            $manager->forgetDrivers();

        });

    }

}
<?php             return;

        }



        with($event->sandbox->make(Hub::class), function ($hub) use ($event) {

            $hub->setContainer($event->sandbox);

        });

    }

}
<?php             return;

        }



        with($event->sandbox->make('queue'), function ($manager) use ($event) {

            $manager->setApplication($event->sandbox);

        });

    }

}
<?php             return;

        }



        with($event->sandbox->make('validator'), function ($factory) use ($event) {

            $factory->setContainer($event->sandbox);

        });

    }

}
<?php             return;

        }



        with($event->sandbox->make('view'), function ($view) use ($event) {

            $view->setContainer($event->sandbox);



            $view->share('app', $event->sandbox);

        });

    }

}