scaffold-model
3
总安装量
3
周安装量
#59494
全站排名
安装命令
npx skills add https://github.com/iurygdeoliveira/labsis-kit --skill scaffold-model
Agent 安装分布
claude-code
2
windsurf
1
trae
1
opencode
1
codex
1
antigravity
1
Skill 文档
Laravel Model Scaffold Skill
Use this skill to create or modify Eloquent Models.
Rules
1. Structure
- Strict Types: Always
declare(strict_types=1);. - Final: Models should be
finalunless they are explicitly designed for inheritance. - Fillable: Prefer
$fillableover$guardedfor explicit security.
2. Modern Casting (Laravel 12)
- Use the
casts(): arraymethod (Laravel 11+), NOT the$castsproperty. - Use Enums for status columns and native types.
protected function casts(): array
{
return [
'status' => TicketStatus::class,
'published_at' => 'datetime',
'is_active' => 'boolean',
'options' => 'array',
];
}
3. Relationships
- Always add return types to relationship methods (
BelongsTo,HasMany, etc.). - Import the relation classes (
Illuminate\Database\Eloquent\Relations\BelongsTo).
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
4. Scopes
- Use
Buildertype hint for scopes.
public function scopeActive(Builder $query): void
{
$query->where('is_active', true);
}