diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index edc1771..785953f 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -46,6 +46,8 @@ class InvoiceController extends Controller 'due_date' => 'required|date|after_or_equal:issue_date', 'notes' => 'nullable|string', 'signature_image' => 'nullable|image|max:2048', + 'signer_name' => 'nullable|string|max:255', + 'signer_title' => 'nullable|string|max:255', 'bank_name' => 'nullable|string|max:100', 'bank_account' => 'nullable|string|max:50', 'bank_holder' => 'nullable|string|max:100', @@ -108,6 +110,8 @@ class InvoiceController extends Controller 'paid_date' => 'nullable|date', 'notes' => 'nullable|string', 'signature_image' => 'nullable|image|max:2048', + 'signer_name' => 'nullable|string|max:255', + 'signer_title' => 'nullable|string|max:255', 'bank_name' => 'nullable|string|max:100', 'bank_account' => 'nullable|string|max:50', 'bank_holder' => 'nullable|string|max:100', diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index cd1b2fb..0551896 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -21,7 +21,7 @@ class Invoice extends Model 'subtotal', 'tax_rate', 'tax_amount', 'total', 'currency', 'status', 'issue_date', 'due_date', 'paid_date', 'notes', 'bank_name', 'bank_account', 'bank_holder', 'branch_name', - 'signature_image', + 'signature_image', 'signer_name', 'signer_title', ]; protected $casts = [ diff --git a/database/migrations/2026_04_05_000002_add_signer_details_to_invoices.php b/database/migrations/2026_04_05_000002_add_signer_details_to_invoices.php new file mode 100644 index 0000000..509ddfc --- /dev/null +++ b/database/migrations/2026_04_05_000002_add_signer_details_to_invoices.php @@ -0,0 +1,23 @@ +string('signer_name')->nullable()->after('signature_image'); + $table->string('signer_title')->nullable()->after('signer_name'); + }); + } + + public function down(): void + { + Schema::table('invoices', function (Blueprint $table) { + $table->dropColumn(['signer_name', 'signer_title']); + }); + } +}; diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 7e9527d..cd43334 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -20,11 +20,27 @@ if [ ! -f .env ]; then fi # ── 2. Generate APP_KEY if empty ──────────── -if grep -qE '^APP_KEY=$' .env 2>/dev/null; then - echo "[key] Generating application key…" - php artisan key:generate --force --quiet +if ! grep -qE '^APP_KEY=base64:' .env 2>/dev/null; then + echo "[key] Generating application key directly…" + + # 2a. Clear cached configs that might cause MissingAppKeyException + php artisan config:clear --quiet 2>/dev/null || true + + # 2b. Generate native base64 key + NEW_KEY="base64:$(php -r 'echo base64_encode(random_bytes(32));')" + + if grep -q '^APP_KEY=' .env 2>/dev/null; then + # Replace existing empty/invalid APP_KEY safely + sed -i "s|^APP_KEY=.*|APP_KEY=$NEW_KEY|" .env + else + # Append nicely + echo "APP_KEY=$NEW_KEY" >> .env + fi fi +# 2c. Force Laravel to read from .env by ditching Docker's empty OS injection +unset APP_KEY + # ── 3. Ensure SQLite database file exists ─── if [ ! -f database/database.sqlite ]; then echo "[db] Creating SQLite database file…" diff --git a/resources/views/invoices/create.blade.php b/resources/views/invoices/create.blade.php index 49bb966..3a611f2 100644 --- a/resources/views/invoices/create.blade.php +++ b/resources/views/invoices/create.blade.php @@ -123,31 +123,62 @@ - {{-- Bank Info --}} -
Leave blank to use your default signature from settings.
+Leave blank to use your default signature from settings.
- -Upload a specific signature for this invoice. Leave blank to keep the current one.
+ + @if($invoice->signature_image) +Upload a specific signature for this invoice. Leave blank to keep the current one.
- - @if($invoice->signature_image) -