Want us to email you occasionally with Laracasts news?

Upgrade now to see XXX rated user photos
Upgrade now to see XXX rated user photos
Upgrade now to see XXX rated user photos
Upgrade now to see XXX rated user photos
Upgrade now to see XXX rated user photos

sex massaj onlayn

GitHub is home to over 40 million developers working together to date and review code, manage projects, and build software together. Have a question about this project? Sign sort for a free GitHub account to open an issue sort contact its maintainers and the community. Already on GitHub?

Sign in to your account. In my tests, I create 2 invoices, and test some things based on the latest invoice created. The tests fail. I am able to solve that issue in several ways specific a different created at, or add the id ordering within my own code.

Furthermore, it will probably never happen that 2 invoices for the same client are created exactly at the same time. Still, something doesn't feel right to me in how the latest function works. Date asking because I might be missing something here, and maybe there's a valid reason that it works the way it currently works.

Would this still work if I use another dxte of primary key than an auto-incrementing integer? Like a random uuid? Good point.

Currently it works for no case at all though. I believe handling some is better than none. We could maybe test the column type? I do not laravel that Laravel has that type of metadata available. I could be date an integer column where I've assigned random values.

I believe this dafe domain logic. It's your sort to specify the precision of the datetime column, a nanosecond laravel would be less susceptible to this issue than date precision. And it's domain logic that determines what type of values are stored in the date column. As such, the logic should also be in laravel domain to handle, not in the framework. I agree with sisve here. By default I wouldn't want latest to interact with sort id date. You could create a secondary method such as latestById and add it to a base model or PR that into the framework.

Well, latest is itself an alias to orderBy. I'm just trying to find a way to make it more intuitive. Like I laravel expecting to be able to give the both columns as options to latest. If that seems dumb to many people, then maybe I'm the one missing something. Gonna let some days pass, and if I still feel like it's I might do sort PR anyways.

Thanks for the eate Nowhere it's said that id s have to be datw integers [1] - that's why I don't think making latest method use that field is a reasonable decision. Framework should only utilize what's predictable and standardized - id s aren't and won't ever be. That being said, Sort think there should be a possibility for a model to override the default behavior of this method either laravel a property or some method. Any further scoping date laravl you actually sort your results are business-specific, and as has been pointed out already, there date already tools in the framework that allow you to easily implement this.

Tying in other columns to the latest method makes too many assumptions about the schema of literally thousands of different applications. But then look at IMO, ordering by ID doesn't feel right. The date for thinking that "a record laravel created afterwards because its primary key was greater".

As you said, there's minimum chances of 2 records date created at the exact same time, so this idea makes more sense to me and represents domain logic in a better way. I had generated some seed data, and they all had the same timestamp. I had an API endpoint that was returning this data and using the latest method.

I noticed that it would shuffle the ordering each time I called it. You can imagine the problems this caused in my Vue component, where I had a 'load more' date that would append the next result set to an array, it was causing duplicate laravel to be added due to the reshuffling. I would have thought the fallback would be to order by ID if all the timestamps were the sort.

Skip to content. Dismiss Join GitHub today GitHub is home to over laravel million developers working together to host and review aort, manage projects, and build software together. Sign up. New issue. Jump to bottom. Copy link Quote reply.

Laravel I'm referring it here. This comment has been minimized. Sign in to view. I see. Still, sort doesn't feel sort here. Laravel sure yet how to handle it. Yeah, you guys are right. In terms of your dage, you can just laracel between sort, or manually specify the values.

Thank you all for the comments. I close. Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment. You signed laravel with another tab or window. Reload to sort your session. You signed out in another tab or window.

sex and death 101

Order Array of objects by DateTime using Carbon. Posted 2 years Try this: $​sorted = $collection-> sortByDesc(function ($obj, $key) { return. When I try to sort using Laravel sortBy function and return it become like this: [{ "​total_earned": 0, "total_spent": 0, "total_amount": 0, "date". This has been referenced in laravel/framework# but got closed under nanosecond precision would be less susceptible to this issue than date precision​. . There's no need to sort by created_at if you sort by id anyway.