Comments (14)
Its working! Thanks
I'm glad to hear, thanks for the detailed descriptions, it helped a lot friend.
from simple-php-router.
What is returned if you do this?
url('games.edit', [5])
from simple-php-router.
What is returned if you do this?
url('games.edit', [5])
Same. And there is not much detailed information about the resource controller on Wiki. It would be good to have more information on Wiki.
Laravel resource controller routes:
It would be better to use a similar structure.
Verb | URI | Action | Route Name |
---|---|---|---|
GET | /photos/{photo}/comments | index | photos.comments.index |
GET | /photos/{photo}/comments/create | create | photos.comments.create |
POST | /photos/{photo}/comments | store | photos.comments.store |
GET | /comments/{comment} | show | comments.show |
GET | /comments/{comment}/edit | edit | comments.edit |
PUT/PATCH | /comments/{comment} | update | comments.update |
DELETE | /comments/{comment} | destroy | comments.destroy |
from simple-php-router.
Also you can add except method for resource routes.
Like this:
SimpleRouter::resource('/games', GameController::class)->name('games')->except(["show", "destroy"]);
from simple-php-router.
I will have to look into why it's not working as intended, the reason I asked you to try without naming the parameter was to see if it was a problem with the parameters. By not defining a name it should add the value to the first parameter found regardless if the name matche or not, which it doesn't for some reason.
What version of the library are you using?
from simple-php-router.
I will have to look into why it's not working as intended, the reason I asked you to try without naming the parameter was to see if it was a problem with the parameters. By not defining a name it should add the value to the first parameter found regardless if the name matche or not, which it doesn't for some reason.
What version of the library are you using?
latest version
from simple-php-router.
It should be working as intended on version 5.3.0.4. (readme still needs work, i'll save that joy for later).
from simple-php-router.
It's not working as expected. I think there is a cache issue. When I call url('games.update', ['id' => 1]) after calling url('games.store') it gives the same output as my first call.
from simple-php-router.
Weird output:
/games/2/edit/edit/
/games/1/edit/
/games/6/edit/
echo url('games.edit', ['id' => 2]);
echo "\n";
echo url('games.update', ['id' => 1]);
echo "\n";
echo url('games.store');
from simple-php-router.
Weird output:
/games/2/edit/edit/ /games/1/edit/ /games/6/edit/
echo url('games.edit', ['id' => 2]); echo "\n"; echo url('games.update', ['id' => 1]); echo "\n"; echo url('games.store');
That's very weird, especially since it's not caught by the phpunit test i added. I wonder where it gets id =6 from in the last url. Do you call anything with id 6 in your code previous to this that could help me debug?
from simple-php-router.
Weird output:
/games/2/edit/edit/ /games/1/edit/ /games/6/edit/
echo url('games.edit', ['id' => 2]); echo "\n"; echo url('games.update', ['id' => 1]); echo "\n"; echo url('games.store');
That's very weird, especially since it's not caught by the phpunit test i added. I wonder where it gets id =6 from in the last url. Do you call anything with id 6 in your code previous to this that could help me debug?
Yes I tried with id=6 at first. And that's how it stuck. Not updating.
from simple-php-router.
First time you call the url() it gives the correct one? But not afterwards?
from simple-php-router.
I see my unit-test used the same parameter value for all the urls, so that could explain why it "worked"/passed the tests.
I've redone the findUrl method, it works with different parameters at least in the unit test. Hopefully it fixes it for you aswell.
Let's try again in version 5.3.0.5
from simple-php-router.
Its working! Thanks
from simple-php-router.
Related Issues (20)
- Loaded route not available to middelware? HOT 1
- InputItem::offset returntype HOT 5
- Method of a controller does not receive the data by POST HOT 7
- Uncaught Pecee\SimpleRouter\Exceptions\NotFoundHttpException using Postman/Ajax HOT 3
- How to return a simple .php webpage? HOT 2
- Bad Request error when url's parameters contain "%" using regex HOT 2
- Bugs not displayed HOT 11
- PCEE inside a subfolder - Why is there need to put the sub folder as path can't we have it as Laravel does HOT 2
- PHP 8.1 Gives error DEPRECATED HOT 3
- 5.3.0.1 hides exception cause HOT 1
- LoadableRoute::setUrl() doesn't empty the parameter array
- How can I add before and after hooks to my Controllers? HOT 2
- Nested Resource routes HOT 1
- How can I get real exception instead of Router one? HOT 2
- Incorrect status code returned when catching an error using the SimpleRouter::error() function HOT 3
- How can I manipulate input values? HOT 1
- It throws an error when there is an unexpected value in the URL. HOT 1
- route HOT 3
- Unable to handle url-encoded and form-data request HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from simple-php-router.