get: fn ($value) => ["user", "editor", "admin"][$value]
I have only seen that code from youtube but I don’t understand what this line of code does. Does this work like a map in php?
>Solution :
That’s an arrow function: https://www.php.net/manual/en/functions.arrow.php
That code is equivalent to this:
get: function ($value) {
$arr = ["user", "editor", "admin"];
return $arr[$value];
}