<?php

use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Route;

Route::get('/', function () {
    return view('welcome');
});

Route::get('/clear', function () {
    Artisan::call('config:clear');
    Artisan::call('cache:clear');
    Artisan::call('route:clear');
    Artisan::call('view:clear');
    return response()->json(['message' => 'All caches cleared.']);
});

Route::get('/storage-link', function () {
    if (file_exists(public_path('storage'))) {
        return response()->json(['message' => 'Storage link already exists.']);
    }
    Artisan::call('storage:link');
    return response()->json(['message' => 'Storage link created.']);
});
