fix articles datatables, enhance statistics
This commit is contained in:
@@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user