.cursor/skills/nazim-file-storage/SKILL.md
--- name: nazim-file-storage description: Centralized file storage for Nazim backend. Use when adding uploads, downloads, or file paths. ALWAYS use FileStorageService; never direct Storage:: or move_uploaded_file. Paths include organization_id and school_id. --- # Nazim File Storage All file operations must use **FileStorageService** (`backend/app/Services/Storage/FileStorageService.php`). Never use `Storage::`, `move_uploaded_file()`, or hardcoded paths. ## Path Structure - **Private:** `pr
npx skillsauth add AHMADJAN-New/nazim-web .cursor/skills/nazim-file-storageInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
All file operations must use FileStorageService (backend/app/Services/Storage/FileStorageService.php). Never use Storage::, move_uploaded_file(), or hardcoded paths.
private/organizations/{org_id}/schools/{school_id}/resource_type/...public/organizations/{org_id}/schools/{school_id}/...| Resource | Category | Disk | Reason | |----------|----------|------|--------| | Students | Pictures, documents | Private | Sensitive | | Staff | Pictures | Public | UI display | | Staff | Documents | Private | Sensitive | | Courses | Documents | Private | May be sensitive | | DMS | All | Private | Sensitive | | Events | Attachments, photos | Private | May be sensitive | | Events | Banners, thumbnails | Public | Public display | | Templates | Backgrounds | Private | Internal | | Reports | All | Private | Sensitive |
use App\Services\Storage\FileStorageService;
public function __construct(
private FileStorageService $fileStorageService
) {}
public function uploadFile(Request $request, string $id)
{
$file = $request->file('file');
$resource = YourResource::findOrFail($id);
$filePath = $this->fileStorageService->storeYourResourceFile(
$file,
$resource->organization_id,
$resource->id,
$resource->school_id
);
$resource->update(['file_path' => $filePath]);
$url = $this->fileStorageService->getPrivateDownloadUrl($filePath);
// Or getPublicUrl($filePath) for public files
return response()->json(['path' => $filePath, 'url' => $url]);
}
public function downloadFile(Request $request, string $id)
{
$resource = YourResource::findOrFail($id);
return $this->fileStorageService->downloadFile(
$resource->file_path,
$resource->file_name
);
}
public function deleteFile(Request $request, string $id)
{
$resource = YourResource::findOrFail($id);
if ($resource->file_path) {
$this->fileStorageService->deleteFile($resource->file_path);
}
$resource->delete();
return response()->noContent();
}
Website uploads use methods like storeWebsiteLibraryCover, storeWebsiteLibraryPdf, storeWebsiteMediaItem, etc.
tools
Toast notifications for Nazim. Use when showing success/error/info messages. ALWAYS use showToast from @/lib/toast with translation keys; never toast from sonner directly. RTL positioning is automatic.
tools
Enforces status badge patterns for Nazim UI. Use when displaying status in tables, cards, or dialogs. Covers Badge variants, semantic colors, statusBadgeVariant, statusOptions with color.
development
Enforces mobile-first responsive patterns for Nazim UI. Use when building pages, tables, forms, charts, or buttons. Covers page container, FilterPanel, tabs, grids, tables, charts, cards, buttons.
development
PDF and Excel report generation for Nazim. Use when adding or changing reports. Backend uses ReportService and ReportConfig; frontend uses useServerReport. Covers branding, DateConversionService, RTL, acceptance criteria.