mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-19 00:22:15 +00:00
controller refactoring part 17
This commit is contained in:
@@ -3,10 +3,12 @@ namespace Domain\Traffic\Models;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
/**
|
||||
* @method static whereYear(string $string, string $string1, int $year)
|
||||
* @method static currentMonth()
|
||||
*/
|
||||
class Traffic extends Model
|
||||
{
|
||||
@@ -22,6 +24,13 @@ class Traffic extends Model
|
||||
|
||||
protected $keyType = 'string';
|
||||
|
||||
public function scopeCurrentMonth($query): Builder
|
||||
{
|
||||
return $query
|
||||
->whereYear('created_at', '=', now()->year)
|
||||
->whereMonth('created_at', '=', now()->month);
|
||||
}
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
Reference in New Issue
Block a user