What is the best way to do comparisons? #184
Answered
by
jasminetracey
jasminetracey
asked this question in
Q&A
-
So i have a Published class state class Published extends MemorialState
{
public static $name = 'published';
} // State here is set to published state class
if ($state === 'published') // false
if ($state == 'published') // true
if ($state === Published::class) // false
if ($state === Published::$name) // false What is the best way to compare the state? |
Beta Was this translation helpful? Give feedback.
Answered by
jasminetracey
Aug 5, 2021
Replies: 2 comments
-
Did some code diving and found that there is an equals check on the state class so i am using if(status->equals(Published::class)) //true |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
jasminetracey
-
Where can I find this in the documentation? Finding it hard to justify using this package if there's little eloquent helpers that I could probably build myself |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Did some code diving and found that there is an equals check on the state class so i am using