Skip to content
Discussion options

You must be logged in to vote

It is better not to use a scope for this purpose.

You can do this:‌

public function customFilter($value)
{
   return $this->where('column', $value)->first();
}
$result = ModelName::customFilter($value);
// Or
$result = ModelName::where('column','value')->customFilter($value);

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pafernandez-oesia
Comment options

Answer selected by pafernandez-oesia
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants