fix articles datatables, enhance statistics

This commit is contained in:
ludo
2024-01-28 19:56:13 +01:00
parent 0bb75125a7
commit 502b71617a
7 changed files with 81 additions and 21 deletions

View File

@@ -4,12 +4,13 @@ namespace App\Models\Shop;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use LaracraftTech\LaravelDateScopes\DateScopes;
use Venturecraft\Revisionable\RevisionableTrait;
use Znck\Eloquent\Traits\BelongsToThrough;
class Invoice extends Model
{
use BelongsToThrough, RevisionableTrait, SoftDeletes;
use BelongsToThrough, DateScopes, RevisionableTrait, SoftDeletes;
protected $guarded = ['id'];
@@ -49,8 +50,8 @@ class Invoice extends Model
return $query->where('id', $id);
}
public function scopeByPeriod($query, $start, $end)
public function scopeByPeriod($query, $start, $end, $field = 'created_at')
{
return $query->whereBetween('created_at', [$start, $end]);
return $query->whereBetween($field, [$start, $end]);
}
}

View File

@@ -4,11 +4,12 @@ namespace App\Models\Shop;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use LaracraftTech\LaravelDateScopes\DateScopes;
use Venturecraft\Revisionable\RevisionableTrait;
class Order extends Model
{
use RevisionableTrait, SoftDeletes;
use DateScopes, RevisionableTrait, SoftDeletes;
protected $guarded = ['id'];