Comments (14)
Some insights -
// routes/web.php
Route::resource(
'users', 'UserController', ['only' => [
'index', 'store', 'edit', 'update'
]]
);
Ziggy example
route('users.edit',{user:1}).url()
Result -
"http://app.local/users/1/edit"
It does not look for id
but user
property because the route requires {user}.
$ php artisan route:list | grep users.edit
| | GET|HEAD | users/{user}/edit | users.edit | App\Http\Controllers\UserController@edit | web,auth,role:admin,can:manage-users,user |
Notice the {user}
in url
from ziggy.
Yeah that test is passing...
@lamberttraccard if you can give me a combination of a route definition and a Ziggy usage that makes this break, please re-open.
I'd love a failing test
from ziggy.
It is not merged yet as Daniel said
It may have gotten lost in the big rewrite. I'll go back and look to see if it's there.
@DanielCoulbourne can you look at @avrahamappel test
from ziggy.
I had this error a few times now.
Make sure that the value you are passing to object is defined/not empty!
from ziggy.
Thanks I’ll look into this today.
from ziggy.
@lamberttraccard can you show me the code that caused this error?
from ziggy.
from ziggy.
Thanks @ankurk91, yes it's seems that Ziggy doesn't work with route model binding.
from ziggy.
I know we did support looking up by generic ID at one point. I believe @jesseleite wrote that.
It may have gotten lost in the big rewrite. I'll go back and look to see if it's there.
from ziggy.
Yessir 👌 https://github.com/tightenco/ziggy/blob/master/tests/js/test.route.js#L101-L113
from ziggy.
@DanielCoulbourne
I'm having this issue as well.
route('contracts.revise', {id:1}).url()
I get
Uncaught Error: Ziggy Error: 'contract' key is required for route 'contracts.revise'
Route definition:
Route::post('contracts/{contract}/revise', 'ContractController@revise')->name('contracts.revise');
I don't have anything filtered right now.
from ziggy.
Try this @avrahamappel
route('contracts.revise', {contract:1}).url()
from ziggy.
I understand, but that was my test case. In reality I'm passing a JavaScript representation of an Eloquent Model in there, and according to what I understood from the above discussion, Ziggy should be able to find the id
field in the object.
from ziggy.
Will do! May be a day or two unfortunately but thanks for the heads up.
from ziggy.
Related Issues (20)
- Default route parameters are not populated in Laravel redirects
- Generated types don't match generated routes when using Vue
- Typescript, Vite, and, Vue cannot be used together
- Model binding through custom route key (getRouteKeyName) only works on first level of url HOT 5
- False negative with route().current() and nested params
- Using `route()->current('...*')` multiple time issue
- Arrow function given to Event::listen stops further propagating of the event HOT 2
- Vue Plugin isnt delivered with Composer package
- Laravel 11 support HOT 2
- Class "Tightenco\Ziggy\Ziggy" Not Found After Upgrading to Laravel 11 HOT 2
- This package does not work with Folio named routes HOT 1
- Passing Ziggy configuration to Inertia.js SSR in a Svelte app
- TypeError when optional params omitted from array
- package does not handle a Vue 2 codebase well HOT 1
- Vue: Cannot convert undefined or null to object
- Feature: Add ```route().queryParams``` to get only query params without laravel route params
- Export Helper type to get the parameters type of specific route
- Missing alert or Logic problem on current route method
- Ziggy generates URL with a double leading slash HOT 6
- Error message : Ziggy is not defined
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 ziggy.