Giter Club home page Giter Club logo

Comments (14)

skipperbent avatar skipperbent commented on June 10, 2024 1

Its working! Thanks

I'm glad to hear, thanks for the detailed descriptions, it helped a lot friend.

from simple-php-router.

skipperbent avatar skipperbent commented on June 10, 2024

What is returned if you do this?

url('games.edit', [5])

from simple-php-router.

benfiratkaya avatar benfiratkaya commented on June 10, 2024

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.

benfiratkaya avatar benfiratkaya commented on June 10, 2024

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.

skipperbent avatar skipperbent commented on June 10, 2024

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.

benfiratkaya avatar benfiratkaya commented on June 10, 2024

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.

skipperbent avatar skipperbent commented on June 10, 2024

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.

benfiratkaya avatar benfiratkaya commented on June 10, 2024

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.

benfiratkaya avatar benfiratkaya commented on June 10, 2024

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.

skipperbent avatar skipperbent commented on June 10, 2024

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.

benfiratkaya avatar benfiratkaya commented on June 10, 2024

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.

skipperbent avatar skipperbent commented on June 10, 2024

First time you call the url() it gives the correct one? But not afterwards?

from simple-php-router.

skipperbent avatar skipperbent commented on June 10, 2024

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.

benfiratkaya avatar benfiratkaya commented on June 10, 2024

Its working! Thanks

from simple-php-router.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.