Last active
June 11, 2022 05:30
-
-
Save maksimerohin/df3437398e26188f31158e483fb266e8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
/------------------- | |
/ app/Enums/Role.php | |
/------------------- | |
*/ | |
namespace App\Enums; | |
enum Role: string | |
{ | |
case User = 'user'; | |
case Admin = 'admin'; | |
} | |
/* | |
/------------------- | |
/ routes/web.php | |
/------------------- | |
use App\Enums\Role; | |
Route::get('/users/{role}', function(Role $role) { | |
return $role->value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment