Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented Apr 7, 2021

Regarding the discussion #29 I wrote down my idea of implementing where.

I added a new Attribute Where and made it available for class and method usage.

Usage:

#[Where('my-where', '[0-9]+')]
class MyController
{
    #[Get('my-get-route/{my-where}')]
    public function myGetMethod()
    {
    }

    #[Post('my-post-route/{my-where}/{my-alpha-numeric}')]
    #[WhereAlpha('alpha')]
    #[WhereAlphaNumeric('alpha-numeric')]
    #[WhereNumber('number')]
    #[WhereUuid('uuid')]
    public function myPostMethod()
    {
    }
}

We can improve this by implementing the shorthands laravel implemented either as own Attribute or as parameter for the Wheres attribute.
I'll leave this open for discussion.

Todo:

  • Write docs
  • Implement shorthands?

Copy link
Member

@freekmurze freekmurze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your work on this.

@freekmurze freekmurze merged commit 362670e into spatie:master Apr 8, 2021
@freekmurze
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants