# PDF Upload ve Senkronizasyon Entegrasyon Rehberi / PDF Upload and Synchronization Integration Guide Bu rehber, herhangi bir modüle PDF dosya yükleme özelliği ve otomatik veritabanı eşleştirme (sync) altyapısının nasıl ekleneceğini açıklar. This guide explains how to add PDF file upload functionality and automatic database synchronization infrastructure to any module. ## Genel Bakış / Overview Sistem, yüklenen PDF dosyalarını isimlendirme kurallarına göre veritabanındaki kayıtlarla otomatik olarak eşleştirir. İşlem 4 ana adımdan oluşur: The system automatically matches uploaded PDF files with database records based on naming conventions. The process consists of 4 main steps: 1. **Database Migration**: `download` sütununun eklenmesi. 2. **Module View**: Arayüze yükleme butonu ve indirme linkinin eklenmesi. 3. **Upload Handler**: Dosya yüklendiğinde çalışacak tetikleyicinin (trigger) tanımlanması. 4. **Sync Script**: Dosya adı ile veritabanı kaydını eşleştiren mantığın kurulması. --- ## Adım 1: Veritabanı Migration / Database Migration İlgili modülün tablosuna `download` sütunu eklenmelidir. Add a `download` column to the module's table. ```bash php artisan make:migration add_download_to_itps_table --table=i_t_p_s ``` ```php public function up(): void { Schema::table('i_t_p_s', function (Blueprint $table) { $table->string('download')->nullable(); }); } ``` ## Adım 2: Modül Arayüzü / Module View `resources/views/admin/type/{module}.blade.php` dosyasını düzenleyin. Edit the module's blade file. ### a. Sütun Tanımı / Column Definition `$relationDatas` dizisine `download` alanını ekleyin. Add the `download` field to `$relationDatas`. ```php $relationDatas = [ 'download' => [ 'type' => 'link-search', 'html' => '' ], // ... ]; ``` ### b. Blok Grubu / Block Group `$blockGroup` dizisinde uygun yere (genellikle 'General Info') ekleyin. Add to `$blockGroup` array. ### c. Yükleme Ayarları / Upload Configuration Dosyanın en altına, PHP bloğunun içine yükleme ayarlarını ekleyin. Add upload settings inside the PHP block. ```php $firstUploadFolder = '004_QA/000_ITP/'; // Hedef klasör / Target folder $firstUploadTitle = 'Upload PDF'; $uploadPermissionKey = 'itp_upload_permission'; ``` ### d. Include Upload Component Sayfanın HTML kısmına upload bileşenini dahil edin. Include the upload component in the HTML section. ```php