PHP code example of mpyw / laravel-unique-violation-detector
1. Go to this page and download the library: Download mpyw/laravel-unique-violation-detector library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mpyw / laravel-unique-violation-detector example snippets
use Mpyw\LaravelUniqueViolationDetector\UniqueViolationDetector;
use Mpyw\LaravelUniqueViolationDetector\Facades\Unique;
// Detect on a specific connection via explicitly created detector instance
// (Recommended usage in libraries)
$violated = (new UniqueViolationDetector($connection))->violated($e);
// Detect on the default connection
$violated = Unique::violated($exception);
// Detect on a specific connection via Facade
$violated = Unique::forConnection($connection)->violated($e);