-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question about obtaining list or urls from web file and the method type #42
Comments
Hello. Thanks for your using the package. |
Hi thanks for your response and your example
The one you gave me I found only pulls rhe current route
As I said if I use print_r($url) I get rhe list off All data including the
url the name and the method but if I do $url ijna for each loop adding path
and method it doesn't display anything when echoing
I need to display all the admin routes listed inside the web routing file
Tia
…On Mon, 20 Dec 2021, 07:50 Milad Rahimi, ***@***.***> wrote:
Hello. Thanks for your using the package.
Please update to the latest version if you haven't already.
Read the following section of the package README.
https://github.com/miladrahimi/phprouter#current-route
It illustrates all the available information that a route object provides.
You probably need the "path" and "method" attributes.
—
Reply to this email directly, view it on GitHub
<#42 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHKAGFFLROFI3R5NDR3TIXTUR3N47ANCNFSM5KL6VOGA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
If you mean something like
|
Thanks yh the idea of all() was what I was aiming for I just need to find
away to auto register the routes somehow as I want to implement and roles
and permissions system to that
ent it?
Thanks anyway
Love this script been working with it for last year
Any way or any plans to implement it
…On Mon, 20 Dec 2021, 20:03 Milad Rahimi, ***@***.***> wrote:
If you mean something like $router->all() to get all the registered
routes, no but I can implement it for you.
You can create a ACL middleware to check user access like this {
use MiladRahimi\PhpRouter\Routing\Route;
use Psr\Http\Message\ServerRequestInterface;
class AclMiddleware
{
public function handle(ServerRequestInterface $request, Closure $next, Route $route)
{
// Find the current user => $user
if ($user->can($route->getPath())) {
return $next($request);
}
return new JsonResponse(['error' => 'ACL Error!'], 403);
}
}
—
Reply to this email directly, view it on GitHub
<#42 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHKAGFDM6ZFX2EBONURQKALUR6DZ5ANCNFSM5KL6VOGA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
update to this version and you can call $router->all(). |
So i have checked it i can work with this you have been great and very accomadatng to this request thanks again :) |
Hello again my friend i have a question more of an issue, still loving your router heres the case of use
i am planning on building a roles, and rules system for my website and i want to base it on the url that it is currently at.
so in this case i i can pull all the array values from $url, and the current value if i was to use ROUTE anyway i need to know if there is anyway i can simply pull just the path and the type of method it is
so i can do soemthing like this in kmy admin panel
foreach($url as $path)
{
echo "Path : $path['path'] . "Add rules" . "Method type " . $path['method']
}
i litterly need to detect the url and the method post get etc
and the rest i will do via middleware
thanks in advance
The text was updated successfully, but these errors were encountered: