Not loading states properly #246
Replies: 4 comments 2 replies
-
Hi there, Which problem are you having with this code? |
Beta Was this translation helpful? Give feedback.
-
Created a PR to address this issue #265 |
Beta Was this translation helpful? Give feedback.
-
I am getting this same issue when trying to use I get this error Spatie\ModelStates\Exceptions\InvalidConfig
No states registered for App\States\Subscription\SubscriptionState
at vendor\spatie\laravel-model-states\src\StateConfig.php:136
132▕ */
133▕ public function allowAllTransitions(): StateConfig
134▕ {
135▕ if (empty($this->registeredStates)) {
➜ 136▕ throw new InvalidConfig('No states registered for ' . $this->baseStateClass);
137▕ }
138▕
139▕ $this->allowTransitions(collect($this->registeredStates)->crossJoin($this->registeredStates)->toArray());
140▕
1 app\States\Subscription\SubscriptionState.php:17
Spatie\ModelStates\StateConfig::allowAllTransitions()
2 vendor\spatie\laravel-model-states\src\HasStates.php:121
App\States\Subscription\SubscriptionState::config() Until #265 is merged, what is the way to allow all states to transition to any other state? |
Beta Was this translation helpful? Give feedback.
-
Great news! Looks like my PR #265 was approved and merged into the package. This is no longer an issue. |
Beta Was this translation helpful? Give feedback.
-
Hello
What is this code problem?
spatie/laravel-model-states: ^2.6
laravel/framework: ^9.24
Also I've used
->registerState()
in WithdrawRequestStatus.php, Error disappears butgetStatesFor('status')
returns empty collection. ButWithdrawRequestStatus::all()
works properly and returns full states list (Pending
/Rejected
/Paid
)Beta Was this translation helpful? Give feedback.
All reactions