SPATIE

  • Products
  • Open Source
  • Courses
  • Web Development
VacanciesAboutBlogDocsGuidelinesMerch ↗ Log in

Docs Laravel-model-states Working-with-transitions Transition events

Other versions for crawler v2 v1
    • Introduction
    • Postcardware
    • Requirements
    • Installation & setup
    • Questions and issues
    • Changelog
    • About us

    Working with states

    • Configuring states
    • Serializing states
    • Listing states

    Working with transitions

    • Configuring transitions
    • Custom transition classes
    • Dependency injection in transition classes
    • Retrieving transitionable states
    • Transition events
    • Custom default transition class

    Querybuilder support

    • State scopes

    Request validation

    • State validation rule

Transition events

When a transition is successfully performed, an event will be dispatched called \Spatie\ModelStates\Events\StateChanged. This event hold references to the initial state (initialState), the new state (finalState), the transition class that performed the transition (transition) and the model that the transition was performed on (model).

Retrieving transitionable states
Custom default transition class
Help us improve this page
Testing Laravel

Learn how to write quality tests in Pest and PHPUnit in our video course

Help us improve this page
  • Products
  • Open Source
  • Courses
  • Web Development
VacanciesAboutBlogDocsGuidelinesMerch ↗ Log in

Kruikstraat 22, Box 12
2018 Antwerp, Belgium
info@spatie.be
+32 3 292 56 79
  • GitHub
  • Instagram
  • LinkedIn
  • Twitter
  • Bluesky
  • Mastodon
  • YouTube
  • Privacy
  • Disclaimer

+32 3 292 56 79

Click to call us

    Enter a search term to find results in the documentation.