Created
December 8, 2021 21:43
-
-
Save rachids/1c9c42636ce6546c6303eeafa88869c4 to your computer and use it in GitHub Desktop.
Bunny Custom Builder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Builders; | |
use Illuminate\Database\Eloquent\Builder; | |
class BunnyBuilder extends Builder | |
{ | |
public function old(): self | |
{ | |
return $this->where('birth_date', '<=', now()->subYears(5)); | |
} | |
public function oldAndFluffy(): self | |
{ | |
return $this->old()->where('fluffiness', '>', 75); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment