michaeldyrynda / laravel-model-uuid

This package allows you to easily work with UUIDs in your Laravel models
MIT License
451 stars 47 forks source link

no WhereUuid available in this trait #85

Closed jcherrabi closed 4 years ago

jcherrabi commented 4 years ago

Hello there, i'm not sure if i'm missing something but I do not see WhereUuid method in this trait as suggested in the example on th ereadme // Find a specific post with the default (uuid) column name $post = Post::whereUuid($uuid)->first(); even looking at the source I only see scopeWhereUuid() so have I miss understood something?

davidhemphill commented 4 years ago

The whereUuid method is known as a "Dynamic Where Clause" inside of Laravel: https://laravel.com/docs/5.0/queries. It's essentially a magic method that assumes uuid is a column on your database table. You can do this with any column actually, whereId, whereCreatedAt, etc

devcircus commented 4 years ago

That's how scopes work.

jcherrabi commented 4 years ago

Thanks, and yes, I just got relient so on the intellisense that I was waiting for it to bring it up while typing LOL... maybe I need to adjust something so intellisense can make sense of it...

thank you it works as written and sorry for the misunderstanding .. ;)

andrewmclagan commented 4 years ago

There should be a docbloc so this is recognised

michaeldyrynda commented 4 years ago

Happy to review a PR!

ninjaparade commented 4 years ago

I'd review that PR as well.

ninjaparade commented 4 years ago

@andrewmclagan ping me when its ready to review.

andrewmclagan commented 4 years ago

take a look next week under the pump at the moment :-)

ninjaparade commented 4 years ago

Not sure what you’re doing under the pump? Seems rather odd place to be.

JeroenVanOort commented 4 years ago

It's probably this that would need to be added:

/**
 * @method static Builder whereUuid(string $uuid)
 */

Don't have the time to make a PR now, but came accross an internal PR where a developer added this on application level.

michaeldyrynda commented 4 years ago

Pushed the docblock change. Thanks all!

andrewmclagan commented 4 years ago

@michaeldyrynda great thanks!

@ninjaparade hahaha its an Australian term for "Very busy" never really thought about it deeply...

https://dictionary.cambridge.org/dictionary/english/under-the-pump

ninjaparade commented 4 years ago

image