Created
February 2, 2023 12:02
-
-
Save Sairahcaz/b992be7412168f17d5201f88b7328eb4 to your computer and use it in GitHub Desktop.
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 | |
use LaracraftTech\LaravelUsefulTraits\UsefulScopes; | |
$class = new class extends Model | |
{ | |
use UsefulScopes; | |
protected $timestamps = true; | |
protected $table = 'scope_tests'; | |
}; | |
$class->create(['foo' => 'foo1', 'bar' => 'bar1', 'quz' => 'quz1']); | |
$class->create(['foo' => 'foo2', 'bar' => 'bar2', 'quz' => 'quz2', 'created_at' => now()->yesterday()]); | |
$class::select('foo')->fromYesterday()->first()->toArray(); | |
// return ['foo' => 'foo2'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment