-
-
Save apit/2fc128525a774d6e079b 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
<?php | |
public function routeClass() | |
{ | |
$routeArray = Str::parseCallback(Route::currentRouteAction(), null); | |
if (last($routeArray) != null) { | |
// Remove 'controller' from the controller name. | |
$controller = str_replace('Controller', '', class_basename(head($routeArray))); | |
// Take out the method from the action. | |
$action = preg_replace('/^(get|post|put|delete|patch)/i', '', last($routeArray)); | |
return Str::slug($controller . '-' . $action); | |
} | |
return 'closure'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment