Comments (7)
Hmm ... the solution is probably for the package to ignore the $with
relationships entirely, when making that query.
I'm not at a place where I can test currently, but can you try changing that block to something like:
$results = $query->without([])
->select([$attribute, $this->model->getQualifiedKeyName()])
->get()
->toBase();
I'm not sure if the without([])
is the correct syntax to ignore all eager loading relations, so that might need tweaking.
Thanks!
from eloquent-sluggable.
I haven't been able to try that yet. I did see a possible withoutRelations()
method for models but might not be what is needed.
Eliminating the ->select([$attribute, $this->model->getQualifiedKeyName()])
would of course solve it but I assume this is in the package to keep memory consumption down?
I'll see if I can test it tomorrow. For now, I removed my eager loading $with
and it worked.
from eloquent-sluggable.
Was actually able to test it just now.
Adding ->without([])
didn't work, but using ->without(['role'])
did work. Working code:
$results = $query->without(['role'])
->select([$attribute, $this->model->getQualifiedKeyName()])
->get()
->toBase();
Maybe there's a way to make that manageable through the array in sluggable()
method that also handles the slug source?
from eloquent-sluggable.
->withoutEagerLoads()
should do it, I'd think.
from eloquent-sluggable.
@cviebrock that seems to have done the trick!
As a side note: I also discovered that I only get the error when I have this turned on Model::shouldBeStrict()
in my AppServiceProvider
from eloquent-sluggable.
So, I was trying to make a failing test for this before adding the fix ... but I can't seem to make one. I'm not sure if it's related to the strict mode setting you had, or something else ... but I'm not sure.
If you have some time, would you mind pulling down the issue605
branch of this package and building and testing it on your set up?
from eloquent-sluggable.
Thanks! I'll give this a try this weekend. I believe it is related to the Model::shouldBeStrict()
setting. I only see it when I have the strict mode turned on. I believe that is because the MissingAttributeException
exception only appears when strict mode is on - otherwise, Laravel just stays quiet when trying to access missing attributes.
from eloquent-sluggable.
Related Issues (20)
- Polymorphic One-to-One (Question) HOT 1
- Conditionally force new slug HOT 4
- slug another language HOT 1
- Checking the pull request HOT 1
- Sluggable HOT 1
- throw new \UnexpectedValueException HOT 2
- Я
- Laravel 10 support HOT 8
- Laravel 10 Install issue... HOT 1
- Should findBySlugOrFail return Model instead? HOT 1
- Issue when testing a model factory using make() HOT 3
- Turkish character slug problem
- Slugging behavior when creating a new model varies depending on onUpdate setting HOT 4
- Is it possible to use the slug as source? HOT 4
- SluggableScopeHelpers Trait: Support for orWhere and whereIn HOT 1
- Slugging with Laravel Nova HOT 4
- Remove HTML Tags Before Creating Slug HOT 3
- Case-sensitivity and slug uniqueness HOT 2
- Tag 11.0 version. Laravel 11 just landed 🌕 🚀 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 eloquent-sluggable.