LaravelCollective / annotations

Route and Event Annotations for the Laravel Framework
MIT License
365 stars 73 forks source link

Add ability to specify method for @Bind #26

Closed Anahkiasen closed 6 years ago

Anahkiasen commented 9 years ago

Example:

/**
 * @Bind("user", with="findBySlug")
 */
class User extends Model
{
  // ...
}

Translating to

$router->bind('user', 'User@findBySlug')

Currently if you don't use the default find method, you can't use the annotation.

tshafer commented 9 years ago

Correct, you would need bind your model with a closure to do this. There was discussion about adding something like this but it was decided to keep it simple.

Anahkiasen commented 9 years ago

Correct, you would need bind your model with a closure to do this

What do you mean? The @ syntax works for route bindings too, in my example there would be a findBySlug method on the model

hackel commented 9 years ago

+1 This would be very useful.

hackel commented 8 years ago

@tshafer Any update on this? You very rudely closed my PR without giving any comment or indication as to why it was unacceptable and ignored my request for more information. Let's work to find a reasonable solution to this so that I do not have to continue to maintain a separate fork.