scaffold-observer

Laravel Observer Pattern Skill

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "scaffold-observer" with this command: npx skills add iurygdeoliveira/labsis-kit/iurygdeoliveira-labsis-kit-scaffold-observer

Laravel Observer Pattern Skill

Use this skill when you need to trigger logic based on Eloquent Model events (created, updated, deleted, etc.).

When to use

  • Sending emails after user registration.

  • Logging changes for audit entry.

  • Updating summary tables.

Rules

  1. Silent Handling
  • Observers should handle exceptions gracefully or let them bubble up depending on criticality.

  • Avoid putting slow blocking logic (like API calls) directly in Observer. Dispatch a Job/Event instead.

  1. Registration
  • Ensure the Observer is registered in the model attribute #[ObservedBy(UserObserver::class)] (Laravel 10+ standard) or in AppServiceProvider .

  • Prefer Attributes:

#[ObservedBy(UserObserver::class)] class User extends Authenticatable { // ... }

  1. Methods
  • Type hint the model in the observer methods.

public function created(User $user): void { // ... }

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

scaffold-filament-resource

No summary provided by upstream source.

Repository SourceNeeds Review
General

scaffold-controller

No summary provided by upstream source.

Repository SourceNeeds Review
General

scaffold-filament-page

No summary provided by upstream source.

Repository SourceNeeds Review
General

scaffold-middleware

No summary provided by upstream source.

Repository SourceNeeds Review