Replies: 1 comment 1 reply
-
I doubt they will merge this... but something like this should go in Model or in a trait. In your case I suggest creating a helper method. tryWithTrashed($data['fileable_type'])->get(); The reason why I think they won't merge this is that they would have to make an exception for all possible situations. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
hi, i've been using laravel professionally for ~ 5 years now, so i would love to contribute, but so far i don't know how. if anyone would share some tips i'd be grateful.
code like
$data['fileable_type']::withTrashed()->get()
will error, if the class doesn't useSoftDeletes
.my proposition is to add a method
tryWithTrashed
or similar name that would look like an improved version of thisnow i found that
withTrashed
method comes fromaddWithTrashed
inDatabase/Eloquent/SoftDeletingScope.php
, but the new method couldn't be added there, since model wouldn't have access to it.where could it be placed? i was lookin at places like
Database/Query/Builder.php
orDatabase/Eloquent/Builder.php
but i'm not sure how to test code i'd add there.any help is appreciated.
thanks.
Beta Was this translation helpful? Give feedback.
All reactions