<?php

/**
 * One-time helper to create the public/storage symlink on hosts without SSH.
 * Visit https://itartificer.com/sms-erp/storage-link.php once after deploying,
 * then DELETE this file.
 */

$target = realpath(__DIR__.'/../storage/app/public') ?: __DIR__.'/../storage/app/public';
$link = __DIR__.'/storage';

if (is_link($link) || is_dir($link)) {
    exit('✓ storage link already exists. You can delete storage-link.php now.');
}

if (@symlink($target, $link)) {
    exit('✓ storage link created successfully. Now DELETE storage-link.php for security.');
}

exit('✗ Could not create the symlink (host may disallow symlink()). '
    .'Run "php artisan storage:link" via SSH, or create a symlink public/storage → storage/app/public in File Manager.');
