pruning events
This commit is contained in:
1 parent
3d9239737f
commit
dce543604f
7 files changed
+524
-505
No files matched your search
+14
-1
@@ -2,10 +2,15 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Prunable;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class Event extends Model
|
||||
{
|
||||
use Prunable;
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'has_markets',
|
||||
@@ -28,6 +33,14 @@ class Event extends Model
|
||||
'away_id',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the prunable model query.
|
||||
*/
|
||||
public function prunable(): Builder
|
||||
{
|
||||
return static::where('starttime', '<', now()->subHour(5));
|
||||
}
|
||||
|
||||
public function provider()
|
||||
{
|
||||
return $this->belongsTo(Provider::class);
|
||||
@@ -165,6 +178,6 @@ class Event extends Model
|
||||
|
||||
public function event_bookmaker()
|
||||
{
|
||||
return $this->hasOne(EventBookmaker::class, 'event_id', 'id')->where('bookmaker_id', auth()->user()->bookmaker_id);
|
||||
return $this->hasOne(EventBookmaker::class, 'event_id', 'id')->where('bookmaker_id', Auth::user()->bookmaker_id);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user