This commit is contained in:
2026-05-01 23:40:14 +08:00
commit b8f599a617
3867 changed files with 478663 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
<?php
namespace Illuminate\Database;
use Illuminate\Container\Container;
use Illuminate\Contracts\Database\LostConnectionDetector as LostConnectionDetectorContract;
use Throwable;
trait DetectsLostConnections
{
/**
* Determine if the given exception was caused by a lost connection.
*
* @param \Throwable $e
* @return bool
*/
protected function causedByLostConnection(Throwable $e)
{
$container = Container::getInstance();
$detector = $container->bound(LostConnectionDetectorContract::class)
? $container[LostConnectionDetectorContract::class]
: new LostConnectionDetector();
return $detector->causedByLostConnection($e);
}
}