Created
February 2, 2023 12:02
-
-
Save Sairahcaz/1a426c0fddfc549775ac800f3a601585 to your computer and use it in GitHub Desktop.
This file contains 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')->fromToday()->first()->toArray(); | |
// return ['foo' => 'foo1'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment