Boilerplate generation for data export in CatchAdmin modules.
Install
mkdir -p .claude/skills/export && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/2862" && unzip -o skill.zip -d .claude/skills/export && rm skill.zipInstalls to .claude/skills/export
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Generate Excel export class for CatchAdmin module.Key capabilities
- →Generate PHP export classes for CatchAdmin modules
- →Define custom header mappings for exported data
- →Export database model relationships to Excel
- →Implement controller-based download methods
How it works
The skill generates a PHP class extending the base Export class, which uses the model query to fetch data and map it to specified headers. It supports relationship loading through Eloquent's with method.
Inputs & outputs
When to use export
- →Create Excel export class
- →Define header mappings for exports
- →Export database relations to Excel
About this skill
Step 7: Generate Export Class
创建数据导出类。
File Location
modules/{Module}/Export/{Model}.php
Template
<?php
namespace Modules\{Module}\Export;
use Catch\Support\Excel\Export;
class {Model} extends Export
{
protected array $header = [
'ID', 'Name', 'Created At'
];
public function array(): array
{
return \Modules\{Module}\Models\{Model}::query()
->select('id', 'name', 'created_at')
->get()
->toArray();
}
}
Header Mapping
| Field | Header |
|---|---|
| id | ID |
| name | Name |
| status | Status |
| created_at | Created At |
With Relationships
public function array(): array
{
return {Model}::query()
->with('category')
->get()
->map(fn ($item) => [
$item->id,
$item->name,
$item->category?->name ?? '-',
$item->created_at,
])
->toArray();
}
Controller Usage
public function export(): mixed
{
return {Model}::query()
->select('id', 'name', 'created_at')
->get()
->download(['ID', 'Name', 'Created At']);
}
When not to use it
- →Exporting data outside of the CatchAdmin module structure
Limitations
- →Requires specific file location structure within modules
How it compares
This approach automates the creation of standardized export classes within the CatchAdmin framework instead of manually writing query-to-Excel logic.
Compared to similar skills
export side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| export (this skill) | 1 | 6mo | No flags | Intermediate |
| import | 1 | 6mo | No flags | Beginner |
| woocommerce-code-review | 6 | 3mo | No flags | Intermediate |
| laravel-pdf | 11 | 3mo | Review | Beginner |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by JaguarJack
View all by JaguarJack →You might also like
import
JaguarJack
Generate Excel import class for CatchAdmin module.
woocommerce-code-review
woocommerce
Review WooCommerce code changes for coding standards compliance. Use when reviewing code locally, performing automated PR reviews, or checking code quality.
laravel-pdf
spatie
Generate PDFs from Blade views or HTML using spatie/laravel-pdf. Covers creating, formatting, saving, downloading, and testing PDFs with the Browsershot, Cloudflare, or DOMPDF driver.
woocommerce-backend-dev
woocommerce
Add or modify WooCommerce backend PHP code following project conventions. Use when creating new classes, methods, hooks, or modifying existing backend code. **MUST be invoked before writing any PHP unit tests.**
laravel-specialist
Jeffallan
Use when building Laravel 10+ applications requiring Eloquent ORM, API resources, or queue systems. Invoke for Laravel models, Livewire components, Sanctum authentication, Horizon queues.
woocommerce-dev-cycle
woocommerce
Run tests, linting, and quality checks for WooCommerce development. Use when running tests, fixing code style, or following the development workflow.