LeadImportService parses CSV files to create or update leads, handling validation, transactions, and error reporting.
// Source: https://github.com/liberusoftware/crm-laravel | License: MIT | Copyright 2026 Liberu Software
// Provided via justclaw.it.com; keep this notice with the code.
<?php
declare(strict_types=1);
namespace App\Services;
use App\Models\Contact;
use App\Models\Deal;
use App\Models\Lead;
use App\Models\Pipeline;
use App\Models\Stage;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
use Liberu\CRM\UnifiedConversations\Actions\SyncExternalConversation;
use RuntimeException;
final class LeadImportService
{
/** @return array{created:int,updated:int,skipped:int,errors:list<array{row:int,error:string}>} */
public function import(UploadedFile $file, int $teamId, int $actorId): array
{
$handle = fopen($file->getRealPath(), '
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key