This commit is contained in:
salam committed 2026-10-04 15:25:03 +02:00
1 parent 9bcd4432c6
commit 6f92f9e1d5
1209 files changed
+220940

No files matched your search

+10
View File
@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class AddByMethod extends Model
{
//
}
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class AlarmLevel extends Model
{
//
}
+32
View File
@@ -0,0 +1,32 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class AlarmSetting extends Model
{
protected $fillable = [
'client_bookmaker_id',
'sport_id',
'disabled',
'multiline_setting_id',
'alarm_level_id',
'alarm_threshold',
];
public function multiline_setting()
{
return $this->belongsTo(MultilineSetting::class);
}
public function sport()
{
return $this->belongsTo(Sport::class);
}
public function alarm_level()
{
return $this->belongsTo(AlarmLevel::class);
}
}
+18
View File
@@ -0,0 +1,18 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Bettype extends Model
{
public function sport()
{
return $this->belongsTo(Sport::class);
}
public function matchpart()
{
return $this->belongsTo(Matchpart::class);
}
}
+34
View File
@@ -0,0 +1,34 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class BettypeUser extends Model
{
protected $fillable = [
'user_id',
'sport_id',
'multiline_setting_id',
'sorting',
'is_active',
'unique_key',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'is_active' => 'boolean',
];
}
public function multiline_setting()
{
return $this->belongsTo(MultilineSetting::class);
}
}
+44
View File
@@ -0,0 +1,44 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Bookmaker extends Model
{
protected $fillable = [
'name',
'icon',
'image',
'baid',
'txso',
'txot',
'betsapi',
'direct',
'is_active',
];
public function sport()
{
return $this->belongsTo(Sport::class)->where('is_active', 1);
}
public static function options($arr = [])
{
return Bookmaker::query()->whereIn('id', $arr)->pluck('name', 'id');
}
public static function map()
{
$arr = [];
$res = Bookmaker::query()->where('is_active', 1)->get();
foreach ($res as $value) {
$arr[$value->id] = [
'name' => $value->name,
'icon' => $value->icon,
];
}
return $arr;
}
}
+22
View File
@@ -0,0 +1,22 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Client extends Model
{
protected $casts = [
'bookmaker' => 'json',
'provider' => 'json',
'sport' => 'json',
];
protected $fillable = [
'name',
'homepage',
'bookmaker',
'provider',
'sport',
];
}
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ClientGroupList extends Model
{
protected $casts = [
'client_groups' => 'array',
];
protected $fillable = [
'name',
'sport_id',
'client_id',
'client_groups',
];
public function client_group()
{
return $this->belongsTo(CompetitionGroup::class)->with('country');
}
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ComparingBookmaker extends Model
{
protected $fillable = [
'method_id',
'sport_id',
'bookmaker_id',
'client_bookmaker_id',
'time_lastcheck',
'margin_threshold',
'is_active',
'sorting',
];
public function bookmaker()
{
return $this->belongsTo(Bookmaker::class);
}
public function sport()
{
return $this->belongsTo(Sport::class);
}
}
+36
View File
@@ -0,0 +1,36 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use MongoDB\Laravel\Eloquent\HybridRelations;
class CompetitionGroup extends Model
{
use HybridRelations;
protected $connection = 'mariadb';
protected $fillable = [
'id',
'name',
'sport_id',
'country_id',
'level',
];
public function event()
{
return $this->belongsTo(Event::class, 'id', 'competition_group_id');
}
public function sport()
{
return $this->belongsTo(Sport::class);
}
public function country()
{
return $this->belongsTo(Country::class);
}
}
+38
View File
@@ -0,0 +1,38 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class CompetitionGroupProvider extends Model
{
protected $fillable = [
'sport_id',
'add_by_method_id',
'competition_group_id',
'provider_id',
'provider_group_id',
'add_by_method_id',
'name',
];
public function competition_group()
{
return $this->belongsTo(CompetitionGroup::class);
}
public function provider()
{
return $this->belongsTo(Provider::class);
}
public function sport()
{
return $this->belongsTo(Sport::class);
}
public function add_by_method()
{
return $this->belongsTo(AddByMethod::class);
}
}
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class CountriesItalian extends Model
{
//
}
+20
View File
@@ -0,0 +1,20 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Country extends Model
{
protected $fillable = [
'id',
'name',
'icon',
'iso2',
'iso3',
'cc',
'season_mode',
'is_country',
'disabled',
];
}
+18
View File
@@ -0,0 +1,18 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Customer extends Model
{
protected $fillable = [
'id',
'name',
'homepage',
'bookmaker',
'provider',
'sport',
'is_active',
];
}
+35
View File
@@ -0,0 +1,35 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use MongoDB\Laravel\Eloquent\HybridRelations;
class Element extends Model
{
use HybridRelations;
protected $connection = 'mariadb';
protected $fillable = [
'id',
'name',
'sport_id',
'country_id',
];
public function sport()
{
return $this->belongsTo(Sport::class);
}
public function country()
{
return $this->belongsTo(Country::class);
}
public function element_group()
{
return $this->belongsTo(ElementGroup::class, 'id', 'element_id');
}
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ElementGroup extends Model
{
protected $fillable = [
'element_id',
'group_id',
'competition_group_id',
];
public function element()
{
return $this->belongsTo(Element::class);
}
public function group()
{
return $this->belongsTo(Group::class);
}
public function competition_group()
{
return $this->belongsTo(CompetitionGroup::class);
}
}
+43
View File
@@ -0,0 +1,43 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ElementProvider extends Model
{
protected $fillable = [
'name',
'sport_id',
'element_id',
'provider_id',
'provider_element_id',
'add_by_method_id',
'name',
];
public function sport()
{
return $this->belongsTo(Sport::class);
}
public function element_group()
{
return $this->belongsTo(ElementGroup::class, 'element_id', 'element_id');
}
public function element()
{
return $this->belongsTo(Element::class);
}
public function provider()
{
return $this->belongsTo(Provider::class);
}
public function add_by_method()
{
return $this->belongsTo(AddByMethod::class);
}
}
+182
View File
@@ -0,0 +1,182 @@
<?php
namespace App\Models;
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',
'provider_id',
'betsapi_id',
'betradar_id',
'bet365_id',
'_1xbet_id',
'bwin_id',
'magnig_id',
'magken_id',
'lognig_id',
'logcol_id',
'starttime',
'sport_id',
'country_id',
'group_id',
'competition_group_id',
'home_id',
'away_id',
];
/**
* Get the prunable model query.
*/
public function prunable()
{
return static::where('starttime', '<', now()->subHours(5));
}
public function provider()
{
return $this->belongsTo(Provider::class);
}
public function sport()
{
return $this->belongsTo(Sport::class)->where('is_active', 1);
}
public function country()
{
return $this->belongsTo(Country::class)->where('disabled', 0);
}
public function group()
{
return $this->belongsTo(Group::class);
}
public function competition_group()
{
return $this->belongsTo(CompetitionGroup::class);
}
public function home()
{
return $this->belongsTo(Element::class);
}
public function away()
{
return $this->belongsTo(Element::class);
}
public function home_betsapi()
{
return $this->belongsTo(ElementProvider::class, 'home_id', 'element_id')->where('provider_id', 2);
}
public function away_betsapi()
{
return $this->belongsTo(ElementProvider::class, 'away_id', 'element_id')->where('provider_id', 2);
}
public function odds_2ways()
{
return $this->hasMany(Odds2way::class);
}
public function odds_2ways_s1()
{
return $this->hasMany(Odds2wayS1::class);
}
public function odds_3ways()
{
return $this->hasMany(Odds3way::class);
}
public function odds_3ways_bf()
{
return $this->hasMany(Odds3way::class)->where('bookmaker_id', 110);
}
public function odds_3ways_ht()
{
return $this->hasMany(Odds3wayHt::class);
}
public function odds_dc()
{
return $this->hasMany(OddsDc::class);
}
public function odds_dnb()
{
return $this->hasMany(OddsDnb::class);
}
public function odds_ggng()
{
return $this->hasMany(OddsGgng::class);
}
public function odds_points()
{
return $this->hasMany(OddsPoint::class)->where('active_spread', 1);
}
public function odds_points_q1()
{
return $this->hasMany(OddsPointQ1::class)->where('active_spread', 1);
}
public function odds_points_ht()
{
return $this->hasMany(OddsPointHt::class)->where('active_spread', 1);
}
public function odds_totals()
{
return $this->hasMany(OddsTotal::class)->where('active_spread', 1);
}
public function odds_totals_bf()
{
return $this->hasMany(OddsTotal::class)->where('bookmaker_id', 110);
}
public function odds_totals_q1()
{
return $this->hasMany(OddsTotalQ1::class)->where('active_spread', 1);
}
public function odds_totals_ht()
{
return $this->hasMany(OddsTotalHt::class)->where('active_spread', 1);
}
public function odds_tq()
{
return $this->hasMany(OddsTq::class);
}
public function event_user_star()
{
return $this->hasOne(EventUserStar::class, 'event_id', 'id');
}
public function event_user_note()
{
return $this->hasMany(EventUserNote::class, 'event_id', 'id');
}
public function event_bookmaker()
{
return $this->hasOne(EventBookmaker::class, 'event_id', 'id')->where('bookmaker_id', Auth::user()->bookmaker_id);
}
}
+75
View File
@@ -0,0 +1,75 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class EventBookmaker extends Model
{
protected $fillable = [
'event_id',
'sport_id',
'bookmaker_id',
'starttime',
'bmoid',
'in_feed',
'is_swopped',
'send_status',
'has_to_qualify',
'alarm_2w_h2w',
'alarm_2w_a2w',
'alarm_2ws1_h2w',
'alarm_2ws1_a2w',
'alarm_3w_h3w',
'alarm_3w_d3w',
'alarm_3w_a3w',
'alarm_3wht_h3w',
'alarm_3wht_d3w',
'alarm_3wht_a3w',
'alarm_dc_dc1x',
'alarm_dc_dc12',
'alarm_dc_dcx2',
'alarm_dbn_dnb1',
'alarm_dbn_dnb2',
'alarm_ggng_gg',
'alarm_ggng_ng',
'alarm_po_home',
'alarm_po_away',
'alarm_poht_home',
'alarm_poht_away',
'alarm_poq1_home',
'alarm_poq1_away',
'alarm_to_over',
'alarm_to_under',
'alarm_toht_over',
'alarm_toht_under',
'alarm_toq1_over',
'alarm_toq1_under',
'alarm_tq_htq',
'alarm_tq_atq',
];
public function event()
{
return $this->belongsTo(Event::class);
}
public function bookmaker()
{
return $this->belongsTo(Bookmaker::class);
}
}
+32
View File
@@ -0,0 +1,32 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class EventUserNote extends Model
{
protected $fillable = [
'event_id',
'bookmaker_id',
'user_id',
'client_id',
'message',
'deleted',
];
public function user()
{
return $this->belongsTo(User::class);
}
public function client()
{
return $this->belongsTo(Client::class);
}
public function bookmaker()
{
return $this->belongsTo(Bookmaker::class);
}
}
+13
View File
@@ -0,0 +1,13 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class EventUserStar extends Model
{
protected $fillable = [
'event_id',
'user_id',
];
}
+7
View File
@@ -0,0 +1,7 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ExpectedMinimumPosition extends Model {}
+36
View File
@@ -0,0 +1,36 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Group extends Model
{
protected $fillable = [
'id',
'name',
'fullname',
'mgroup',
'competition_group_id',
'sid',
'sport_id',
'country_id',
'date1',
'date2',
];
public function country()
{
return $this->belongsTo(Country::class);
}
public function sport()
{
return $this->belongsTo(Sport::class);
}
public function competition_group()
{
return $this->belongsTo(CompetitionGroup::class);
}
}
+25
View File
@@ -0,0 +1,25 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class MajorGroup extends Model
{
protected $fillable = [
'id',
'name',
'sport_id',
'country_id',
];
public function country()
{
return $this->belongsTo(Country::class);
}
public function sport()
{
return $this->belongsTo(Sport::class);
}
}
+49
View File
@@ -0,0 +1,49 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Mapper extends Model
{
protected $fillable = [
'event_id',
'betradar_id',
'betsapi_id',
'bet365_id',
'sport_id',
'provider_id',
'starttime',
'country',
'country_id',
'group',
'group_id',
'group_cc',
'home',
'home_id',
'home_cc',
'away',
'away_id',
'away_cc',
];
public function country_betsapi()
{
return $this->belongsTo(Country::class, 'group_cc', 'iso2')->where('is_country', 1)->where('disabled', 0);
}
public function country_magloo()
{
return $this->belongsTo(Country::class, 'country', 'name');
}
public function provider()
{
return $this->belongsTo(Provider::class);
}
public function sport()
{
return $this->belongsTo(Sport::class)->where('is_active', 1);
}
}
+7
View File
@@ -0,0 +1,7 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Matchpart extends Model {}
+33
View File
@@ -0,0 +1,33 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class MultilineClient extends Model
{
protected $fillable = [
'client_bookmaker_id',
'sport_id',
'multiline_setting_id',
'disabled',
'bookmaker_id',
'position',
'sort',
];
public function sport()
{
return $this->belongsTo(Sport::class);
}
public function multiline_setting()
{
return $this->belongsTo(MultilineSetting::class);
}
public function bookmaker()
{
return $this->belongsTo(Bookmaker::class);
}
}
+22
View File
@@ -0,0 +1,22 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class MultilineSetting extends Model
{
protected $fillable = [
'id',
'sport_id',
'name',
'short',
'table',
'sorting',
];
public function sport()
{
return $this->belongsTo(Sport::class);
}
}
+50
View File
@@ -0,0 +1,50 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Odds2way extends Model
{
protected $table = 'odds_2ways';
protected $casts = [
'h2w' => 'float',
'a2w' => 'float',
];
protected $fillable = [
'id',
'event_id',
'sport_id',
'bookmaker_id',
'provider_id',
'offer_id',
'bmoid',
'h2w',
'a2w',
'margin',
'flags',
'nuh_check',
];
public function sport()
{
return $this->belongsTo(Sport::class);
}
public function bookmaker()
{
return $this->belongsTo(Bookmaker::class);
}
public function event()
{
return $this->belongsTo(Event::class);
}
public function provider()
{
return $this->belongsTo(Provider::class);
}
}
+50
View File
@@ -0,0 +1,50 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Odds2wayS1 extends Model
{
protected $table = 'odds_2ways_s1';
protected $casts = [
'h2w' => 'float',
'a2w' => 'float',
];
protected $fillable = [
'id',
'event_id',
'sport_id',
'bookmaker_id',
'provider_id',
'offer_id',
'bmoid',
'h2w',
'a2w',
'margin',
'flags',
'nuh_check',
];
public function sport()
{
return $this->belongsTo(Sport::class);
}
public function bookmaker()
{
return $this->belongsTo(Bookmaker::class);
}
public function event()
{
return $this->belongsTo(Event::class);
}
public function provider()
{
return $this->belongsTo(Provider::class);
}
}
+57
View File
@@ -0,0 +1,57 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Odds3way extends Model
{
protected $table = 'odds_3ways';
protected $casts = [
'h3w' => 'float',
'd3w' => 'float',
'a3w' => 'float',
];
protected $fillable = [
'id',
'event_id',
'sport_id',
'bookmaker_id',
'provider_id',
'offer_id',
'bmoid',
'h3w',
'd3w',
'a3w',
'margin',
'flags',
'nuh_check',
];
public function comparing_bookmaker()
{
return $this->hasOne(ComparingBookmaker::class, 'bookmaker_id', 'bookmaker_id')->where('comparing_bookmakers.sport_id', auth()->user()->sport_id);
}
public function event()
{
return $this->belongsTo(Event::class);
}
public function sport()
{
return $this->belongsTo(Sport::class);
}
public function bookmaker()
{
return $this->belongsTo(Bookmaker::class);
}
public function provider()
{
return $this->belongsTo(Provider::class);
}
}
+52
View File
@@ -0,0 +1,52 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Odds3wayHt extends Model
{
protected $table = 'odds_3ways_ht';
protected $casts = [
'h3w' => 'float',
'd3w' => 'float',
'a3w' => 'float',
];
protected $fillable = [
'id',
'event_id',
'sport_id',
'bookmaker_id',
'provider_id',
'offer_id',
'bmoid',
'h3w',
'd3w',
'a3w',
'margin',
'flags',
'nuh_check',
];
public function event()
{
return $this->belongsTo(Event::class);
}
public function sport()
{
return $this->belongsTo(Sport::class);
}
public function bookmaker()
{
return $this->belongsTo(Bookmaker::class);
}
public function provider()
{
return $this->belongsTo(Provider::class);
}
}
+52
View File
@@ -0,0 +1,52 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class OddsDc extends Model
{
protected $table = 'odds_dc';
protected $casts = [
'dc1x' => 'float',
'dc12' => 'float',
'dc2x' => 'float',
];
protected $fillable = [
'id',
'event_id',
'sport_id',
'bookmaker_id',
'provider_id',
'offer_id',
'bmoid',
'dc1x',
'dc12',
'dcx2',
'margin',
'flags',
'nuh_check',
];
public function sport()
{
return $this->belongsTo(Sport::class);
}
public function bookmaker()
{
return $this->belongsTo(Bookmaker::class);
}
public function event()
{
return $this->belongsTo(Event::class);
}
public function provider()
{
return $this->belongsTo(Provider::class);
}
}
+50
View File
@@ -0,0 +1,50 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class OddsDnb extends Model
{
protected $table = 'odds_dnb';
protected $casts = [
'dnb1' => 'float',
'dnb2' => 'float',
];
protected $fillable = [
'id',
'event_id',
'sport_id',
'bookmaker_id',
'provider_id',
'offer_id',
'bmoid',
'dnb1',
'dnb2',
'margin',
'flags',
'nuh_check',
];
public function sport()
{
return $this->belongsTo(Sport::class);
}
public function bookmaker()
{
return $this->belongsTo(Bookmaker::class);
}
public function event()
{
return $this->belongsTo(Event::class);
}
public function provider()
{
return $this->belongsTo(Provider::class);
}
}
+50
View File
@@ -0,0 +1,50 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class OddsGgng extends Model
{
protected $table = 'odds_ggng';
protected $casts = [
'gg' => 'float',
'ng' => 'float',
];
protected $fillable = [
'id',
'event_id',
'sport_id',
'bookmaker_id',
'provider_id',
'offer_id',
'bmoid',
'gg',
'ng',
'margin',
'flags',
'nuh_check',
];
public function sport()
{
return $this->belongsTo(Sport::class);
}
public function bookmaker()
{
return $this->belongsTo(Bookmaker::class);
}
public function event()
{
return $this->belongsTo(Event::class);
}
public function provider()
{
return $this->belongsTo(Provider::class);
}
}
+15
View File
@@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class OddsName extends Model
{
protected $fillable = [
'name',
'alarm',
'table',
'bettype',
];
}
+53
View File
@@ -0,0 +1,53 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class OddsPoint extends Model
{
protected $table = 'odds_points';
protected $casts = [
'home' => 'float',
'away' => 'float',
];
protected $fillable = [
'id',
'event_id',
'sport_id',
'bookmaker_id',
'provider_id',
'offer_id',
'bmoid',
'home',
'away',
'handicap',
'margin',
'difference',
'active_spread',
'flags',
'nuh_check',
];
public function sport()
{
return $this->belongsTo(Sport::class);
}
public function bookmaker()
{
return $this->belongsTo(Bookmaker::class);
}
public function event()
{
return $this->belongsTo(Event::class);
}
public function provider()
{
return $this->belongsTo(Provider::class);
}
}
+53
View File
@@ -0,0 +1,53 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class OddsPointHt extends Model
{
protected $table = 'odds_points_ht';
protected $casts = [
'home' => 'float',
'away' => 'float',
];
protected $fillable = [
'id',
'event_id',
'sport_id',
'bookmaker_id',
'provider_id',
'offer_id',
'bmoid',
'home',
'away',
'handicap',
'margin',
'difference',
'active_spread',
'flags',
'nuh_check',
];
public function sport()
{
return $this->belongsTo(Sport::class);
}
public function bookmaker()
{
return $this->belongsTo(Bookmaker::class);
}
public function event()
{
return $this->belongsTo(Event::class);
}
public function provider()
{
return $this->belongsTo(Provider::class);
}
}
+53
View File
@@ -0,0 +1,53 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class OddsPointQ1 extends Model
{
protected $table = 'odds_points_q1';
protected $casts = [
'home' => 'float',
'away' => 'float',
];
protected $fillable = [
'id',
'event_id',
'sport_id',
'bookmaker_id',
'provider_id',
'offer_id',
'bmoid',
'home',
'away',
'handicap',
'margin',
'difference',
'active_spread',
'flags',
'nuh_check',
];
public function sport()
{
return $this->belongsTo(Sport::class);
}
public function bookmaker()
{
return $this->belongsTo(Bookmaker::class);
}
public function event()
{
return $this->belongsTo(Event::class);
}
public function provider()
{
return $this->belongsTo(Provider::class);
}
}
+99
View File
@@ -0,0 +1,99 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class OddsTable extends Model
{
// public static function tmp()
// {
// $res = OddsTable::get();
// $arr = [];
// foreach ($res as $value) {
// $names = explode(',', $value->oddnames);
// $fields = explode(',', $value->fieldnames);
// $base = [];
// $base['table'] = $value->name;
// $base['bettype'] = $value->fulltitle;
// $tmp = array_combine($fields, $names);
// foreach ($tmp as $alarm => $name) {
// $base['name'] = $name;
// $base['alarm'] = $alarm;
// $arr[] = $base;
// }
// }
// return $arr;
// }
public static function oddnames()
{
$res = OddsTable::get();
$arr = [];
foreach ($res as $value) {
$names = explode(',', $value->oddnames);
$fields = explode(',', $value->fieldnames);
$arr[$value->name] = array_combine($fields, $names);
}
return $arr;
}
public static function alarm_fieldnames_by_sport()
{
$arr = [];
$arr[1] = [];
$arr[2] = [];
$arr[3] = [];
$arr[5] = [];
$res = OddsTable::get();
foreach ($res as $value) {
$fields = explode(',', $value->fieldnames);
if ($value->soccer == 1) {
$arr[1] = array_merge($arr[1], $fields);
}
if ($value->icehockey == 1) {
$arr[2] = array_merge($arr[2], $fields);
}
if ($value->basketball == 1) {
$arr[3] = array_merge($arr[3], $fields);
}
if ($value->tennis == 1) {
$arr[5] = array_merge($arr[5], $fields);
}
}
return $arr;
}
public static function fields()
{
$res = OddsTable::get();
$arr = [];
foreach ($res as $value) {
$arr[$value->name] = explode(',', $value->oddnames);
}
return $arr;
}
public static function options_sport()
{
switch (auth()->user()->sport_id) {
case 1:
return OddsTable::where('soccer', 1)->pluck('fulltitle', 'id');
case 2:
return OddsTable::where('icehockey', 1)->pluck('fulltitle', 'id');
case 3:
return OddsTable::where('basketball', 1)->pluck('fulltitle', 'id');
case 5:
return OddsTable::where('tennis', 1)->pluck('fulltitle', 'id');
}
return [];
}
}
+53
View File
@@ -0,0 +1,53 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class OddsTotal extends Model
{
protected $table = 'odds_totals';
protected $casts = [
'over' => 'float',
'under' => 'float',
];
protected $fillable = [
'id',
'event_id',
'sport_id',
'bookmaker_id',
'provider_id',
'offer_id',
'bmoid',
'over',
'under',
'total',
'margin',
'difference',
'active_spread',
'flags',
'nuh_check',
];
public function sport()
{
return $this->belongsTo(Sport::class);
}
public function bookmaker()
{
return $this->belongsTo(Bookmaker::class);
}
public function event()
{
return $this->belongsTo(Event::class);
}
public function provider()
{
return $this->belongsTo(Provider::class);
}
}
+53
View File
@@ -0,0 +1,53 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class OddsTotalHt extends Model
{
protected $table = 'odds_totals_ht';
protected $casts = [
'over' => 'float',
'under' => 'float',
];
protected $fillable = [
'id',
'event_id',
'sport_id',
'bookmaker_id',
'provider_id',
'offer_id',
'bmoid',
'over',
'under',
'total',
'margin',
'difference',
'active_spread',
'flags',
'nuh_check',
];
public function sport()
{
return $this->belongsTo(Sport::class);
}
public function bookmaker()
{
return $this->belongsTo(Bookmaker::class);
}
public function event()
{
return $this->belongsTo(Event::class);
}
public function provider()
{
return $this->belongsTo(Provider::class);
}
}
+53
View File
@@ -0,0 +1,53 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class OddsTotalQ1 extends Model
{
protected $table = 'odds_totals_q1';
protected $casts = [
'over' => 'float',
'under' => 'float',
];
protected $fillable = [
'id',
'event_id',
'sport_id',
'bookmaker_id',
'provider_id',
'offer_id',
'bmoid',
'over',
'under',
'total',
'difference',
'active_spread',
'margin',
'flags',
'nuh_check',
];
public function sport()
{
return $this->belongsTo(Sport::class);
}
public function bookmaker()
{
return $this->belongsTo(Bookmaker::class);
}
public function event()
{
return $this->belongsTo(Event::class);
}
public function provider()
{
return $this->belongsTo(Provider::class);
}
}
+50
View File
@@ -0,0 +1,50 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class OddsTq extends Model
{
protected $table = 'odds_tq';
protected $casts = [
'htq' => 'float',
'atq' => 'float',
];
protected $fillable = [
'id',
'event_id',
'sport_id',
'bookmaker_id',
'provider_id',
'offer_id',
'bmoid',
'htq',
'atq',
'margin',
'flags',
'nuh_check',
];
public function sport()
{
return $this->belongsTo(Sport::class);
}
public function bookmaker()
{
return $this->belongsTo(Bookmaker::class);
}
public function event()
{
return $this->belongsTo(Event::class);
}
public function provider()
{
return $this->belongsTo(Provider::class);
}
}
+26
View File
@@ -0,0 +1,26 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class PersonalNotification extends Model
{
protected $fillable = [
'user_id',
'bookmaker_id',
'alarm_level_id',
'notify_by_system',
'notify_by_email',
];
public function bookmaker()
{
return $this->belongsTo(Bookmaker::class);
}
public function alarm_level()
{
return $this->belongsTo(AlarmLevel::class);
}
}
+18
View File
@@ -0,0 +1,18 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class PersonalNotificationSend extends Model
{
protected $fillable = [
'event_id',
'user_id',
'bookmaker_id',
'alarm_level_id',
'fieldname',
'notify_by_system',
'notify_by_email',
];
}
+12
View File
@@ -0,0 +1,12 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Provider extends Model
{
protected $fillable = [
'name',
];
}
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class RosaTournament extends Model
{
//
}
+18
View File
@@ -0,0 +1,18 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class SofaScoreCategory extends Model
{
protected $fillable = [
'id',
'name',
'slug',
'season_mode',
'flag',
'in_soccer',
'country_id',
];
}
+20
View File
@@ -0,0 +1,20 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class SofaScoreDay extends Model
{
protected $fillable = [
'id',
'day',
'sport_id',
'enabled',
];
public function sport()
{
return $this->belongsTo(Sport::class, 'sport_id', 'id');
}
}
+20
View File
@@ -0,0 +1,20 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class SofaScoreDayTournament extends Model
{
protected $fillable = [
'id',
'tournament_id',
'sport_id',
'day',
];
public function tournament()
{
return $this->belongsTo(SofaScoreTournament::class, 'tournament_id', 'tournament_id');
}
}
+20
View File
@@ -0,0 +1,20 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class SofaScoreEventGrapped extends Model
{
protected $fillable = [
'id',
'grapper_id',
'name',
'url',
'starttime',
'got_statistics',
'got_lineups',
'got_odds',
'got_incidents',
];
}
+21
View File
@@ -0,0 +1,21 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class SofaScorePlayerCache extends Model
{
public $incrementing = false;
protected $primaryKey = 'hash';
protected $casts = [
'players' => 'array'
];
protected $fillable = [
'hash',
'players',
];
}
+36
View File
@@ -0,0 +1,36 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class SofaScorePlayerPerSeason extends Model
{
protected $table = 'ss_player_seasons';
protected $fillable = [
'ss_player_id',
'ss_team_id',
'season',
'total_events',
'total_min',
'average_min',
'events_played_home',
'events_played_away',
'minutes_played_home',
'minutes_played_away',
'goals',
'fouls',
'cards',
'offsides',
'shots_on_target',
'shots_off_target',
'shots_blocked',
'total_shots',
];
public function details()
{
return $this->belongsTo(StatistikoDetail::class, 'ss_player_id', 'ss_player_id');
}
}
+35
View File
@@ -0,0 +1,35 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use MongoDB\Laravel\Eloquent\HybridRelations;
class SofaScorePlayerPosition extends Model
{
use HybridRelations;
protected $connection = 'mariadb';
protected $fillable = [
'ss_code',
'name',
'generalposition',
'exp_goals',
'exp_assists',
'exp_cards',
'exp_fouls',
'exp_was_fouled',
'exp_offsides',
'exp_total_shots',
'exp_shots_on_target',
'minexp_goals',
'minexp_assists',
'minexp_cards',
'minexp_fouls',
'minexp_was_fouled',
'minexp_offsides',
'minexp_total_shots',
'minexp_shots_on_target',
];
}
+41
View File
@@ -0,0 +1,41 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use MongoDB\Laravel\Eloquent\HybridRelations;
class SofaScoreRosa extends Model
{
use HybridRelations;
protected $connection = 'mariadb';
protected $fillable = [
'sport_id',
'cc',
'country_id',
'ss_team_id',
'ss_team_name',
'ss_tournament_id',
'slug',
'is_active',
'grapped',
'disabled',
];
public function country()
{
return $this->belongsTo(Country::class);
}
public function sofascore_category()
{
return $this->belongsTo(SofaScoreCategory::class, 'country_id', 'country_id')->where('in_soccer', 1);
}
public function tournament_rosa()
{
return $this->belongsTo(SofaScoreRosaTournament::class, 'ss_team_id', 'ss_team_id');
}
}
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use MongoDB\Laravel\Eloquent\HybridRelations;
class SofaScoreRosaTournament extends Model
{
use HybridRelations;
protected $fillable = [
'ss_team_id',
'ss_tournament_id',
'grapped',
'disabled',
];
public function tournament()
{
return $this->belongsTo(SofaScoreTournament::class, 'ss_tournament_id', 'tournament_id');
}
}
+38
View File
@@ -0,0 +1,38 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Carbon;
class SofaScoreTask extends Model
{
protected $appends = ['duration'];
protected $fillable = [
'name',
'mode',
'sport_id',
'day_from',
'day_to',
'is_active',
'compleated',
'last_start',
'last_end',
];
public function getDurationAttribute(): string
{
return Carbon::parse($this->last_start)->diff(Carbon::parse($this->last_end));
}
public function sport()
{
return $this->belongsTo(Sport::class);
}
public function sofa_score_task_tournaments()
{
return $this->hasMany(SofaScoreTaskTournament::class);
}
}
+14
View File
@@ -0,0 +1,14 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class SofaScoreTaskDay extends Model
{
protected $fillable = [
'grapper_id',
'day',
'done',
];
}
+30
View File
@@ -0,0 +1,30 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class SofaScoreTaskTournament extends Model
{
protected $fillable = [
'sofa_score_task_id',
'sofa_score_tournament_id',
'sofa_score_category_id',
'disabled',
];
public function sofa_score_task_tournaments()
{
return $this->belongsTo(SofaScoreTask::class);
}
public function tournament()
{
return $this->belongsTo(SofaScoreTournament::class, 'sofa_score_tournament_id', 'tournament_id');
}
public function category()
{
return $this->belongsTo(SofaScoreCategory::class, 'sofa_score_category_id', 'id');
}
}
+33
View File
@@ -0,0 +1,33 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use MongoDB\Laravel\Eloquent\HybridRelations;
class SofaScoreTournament extends Model
{
use HybridRelations;
protected $connection = 'mariadb';
protected $fillable = [
'id',
'sport_id',
'tournament_id',
'sofa_score_category_id',
'name',
'slug',
'enabled',
];
public function sport()
{
return $this->belongsTo(Sport::class);
}
public function sofascore_category()
{
return $this->belongsTo(SofaScoreCategory::class, 'sofa_score_category_id', 'id');
}
}
+46
View File
@@ -0,0 +1,46 @@
<?php
namespace App\Models;
use App\Utilities\Notice;
use Illuminate\Database\Eloquent\Model;
class Sport extends Model
{
protected $fillable = [
'ss_grap_years',
];
public static function map(string $field, $reverse = false, $limit = [])
{
if (! in_array($field, ['bapi', 'bwin', 'b365', 'logi', 'magl', 'sofascore'])) {
Notice::note('Sport::map wrong option! Possible options: bapi, bwin, b365, logi, magl, sofascore', 'r', 1);
}
if ($reverse) {
if ($limit) {
return Sport::where('is_active', 1)->whereIn('id', $limit)->pluck('id', $field)->toArray();
} else {
return Sport::where('is_active', 1)->pluck('id', $field)->toArray();
}
} else {
if ($limit) {
return Sport::where('is_active', 1)->whereIn('id', $limit)->pluck($field, 'id')->toArray();
} else {
return Sport::where('is_active', 1)->pluck($field, 'id')->toArray();
}
}
}
public static function getActiveSports()
{
return Sport::query()->where('is_active', 1)->pluck('id')->toArray();
}
public static function getSportForClient(int $client_id)
{
$sports = Client::where('id', $client_id)->value('sport');
return Sport::query()->whereIn('id', $sports)->pluck('name', 'id');
}
}
+16
View File
@@ -0,0 +1,16 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class SsLineupMemory extends Model
{
protected $fillable = [
'client_id',
'team_id',
'lineup',
'placement',
'team_name',
];
}
+57
View File
@@ -0,0 +1,57 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Prunable;
use Illuminate\Support\Carbon;
class StatisticFixtures extends Model
{
use Prunable;
protected $fillable = [
'sport_id',
'league_id',
'home_id',
'away_id',
'starttime',
'exp_home',
'exp_away',
];
protected function casts(): array
{
return [
'starttime' => 'datetime',
];
}
/**
* Get the prunable model query.
*/
public function prunable()
{
return static::where('starttime', '<', Carbon::now('Europe/Vienna')->subMinutes(5));
}
public function sport()
{
return $this->belongsTo(Sport::class)->where('is_active', 1);
}
public function league()
{
return $this->belongsTo(SofaScoreTournament::class, 'league_id', 'tournament_id');
}
public function home()
{
return $this->belongsTo(SofaScoreRosa::class, 'home_id', 'ss_team_id');
}
public function away()
{
return $this->belongsTo(SofaScoreRosa::class, 'away_id', 'ss_team_id');
}
}
+12
View File
@@ -0,0 +1,12 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class StatistikoConfig extends Model
{
protected $fillable = [
'value',
];
}
+49
View File
@@ -0,0 +1,49 @@
<?php
declare(strict_types=1);
namespace App\Models;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use MongoDB\Laravel\Eloquent\Model;
class StatistikoDetail extends Model
{
protected $connection = 'mongodb';
protected $table = 'details';
protected $fillable = [
'ss_player_id',
'ss_team_id',
'player_name',
'ss_national_team_id',
'birthdate',
'height',
'nationality',
'position',
'preferred_foot',
'last_update',
'last_import',
'is_active',
];
protected $casts = [
'last_update' => 'datetime',
];
// public function season()
// {
// return $this->hasMany(SofaScorePlayerPerSeason::class, 'ss_player_id', 'ss_player_id');
// }
public function team(): BelongsTo
{
return $this->belongsTo(SofaScoreRosa::class, 'ss_team_id', 'ss_team_id');
}
public function positions(): BelongsTo
{
return $this->belongsTo(SofaScorePlayerPosition::class, 'position', 'ss_code');
}
}
+71
View File
@@ -0,0 +1,71 @@
<?php
declare(strict_types=1);
namespace App\Models;
use MongoDB\Laravel\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class StatistikoEvent extends Model
{
protected $connection = 'mongodb';
protected $table = 'events';
protected $fillable = [
'sport_id',
'match_id',
'league_id',
'home_id',
'away_id',
'starttime',
'season',
'gls_h',
'gls_a',
'crn_h',
'crn_a',
'fls_h',
'fls_a',
'ofs_h',
'ofs_a',
'snt_h',
'snt_a',
'tsh_h',
'tsh_a',
'crd_h',
'crd_a',
'exp_home',
'exp_away',
'exp_handicap',
'exp_total',
'result_code',
'created_at',
'updated_at',
];
protected $casts = [
'starttime' => 'datetime',
];
public function sport(): BelongsTo
{
return $this->belongsTo(Sport::class, 'sport_id', 'id');
}
public function league()
{
return $this->belongsTo(SofaScoreTournament::class, 'league_id', 'tournament_id');
}
public function home(): BelongsTo
{
return $this->belongsTo(SofaScoreRosa::class, 'home_id', 'ss_team_id');
}
public function away(): BelongsTo
{
return $this->belongsTo(SofaScoreRosa::class, 'away_id', 'ss_team_id');
}
}
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class StatistikoImport extends Model
{
protected $fillable = [
'id',
'sport_id',
'data_type',
'file_name',
'file_name_original',
'run_import',
'has_run',
];
public function sport()
{
return $this->belongsTo(Sport::class)->where('is_active', 1);
}
}
+105
View File
@@ -0,0 +1,105 @@
<?php
namespace App\Models;
use MongoDB\Laravel\Eloquent\Model;
class StatistikoPlayer extends Model
{
protected $connection = 'mongodb';
protected $table = 'players';
protected $fillable = [
'sport_id',
'match_id',
'ss_player_id',
'activeteam_id',
'playersubstitute_id',
'goals',
'assists',
'own_goals',
'shots_on_target',
'shots_off_target',
'shots_blocked',
'fouls',
'was_fouled',
'offsides',
'possessions_lost',
'total_tackles',
'touches',
'total_cross',
'cross_done',
'total_dribbles',
'dribbles_won',
'total_ground_duels',
'total_ground_duels_won',
'total_aerial_duels',
'total_duels_aerial_won',
'total_pass',
'pass',
'total_long_balls',
'long_balls',
'blocked_shots',
'clearances',
'dribbled_past',
'hit_woodwork',
'interceptions',
'key_pass',
'last_man_tackle',
'dispossessed',
'clearance_off_line',
'bcc',
'bcm',
'errors_lead_to_a_goal',
'errors_lead_to_a_shot',
'penalty_committed',
'penalty_miss',
'penalty_save',
'penalty_won',
'saves',
'saves_from_in_box',
'total_runs_out',
'runs_out',
'punches',
'good_high_claim',
'minutes_played',
'lineup',
'minute_event_during_the_match',
'type_event_during_the_match',
'description_event_during_the_match',
'subtype_event_during_the_match',
'card_yellow',
'card_yellowred',
'card_red',
'ingamepenalty_missed',
'penaltyshoutout_scored',
'penaltyshoutout_missed',
'player_position',
'playerrating_value',
'tm_player_id',
];
// IDENTIFICAZIONE
// match_id
// ss_player_id
// AGGIORNAMENTO
// tm_player_id
// penaltyshoutout_missed
// penaltyshoutout_scored
// ingamepenalty_missed,
// card_yellow
// card_yellowred
// card_red
public function event()
{
return $this->belongsTo(StatistikoEvent::class, 'match_id', 'match_id');
}
public function details()
{
return $this->belongsTo(StatistikoDetail::class, 'ss_player_id', 'ss_player_id');
}
}
+41
View File
@@ -0,0 +1,41 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Supervisor extends Model
{
protected $fillable = [
'name',
'provider_id',
'sport_id',
'special_id',
'txodds_market_id',
'sleep',
'limit',
'runtime',
'commandline_options',
'maxsconds',
'lastcall',
'is_supervisor',
'is_active',
'days_from',
'days_to',
];
public function sport()
{
return $this->belongsTo(Sport::class)->where('is_active', 1);
}
public function provider()
{
return $this->belongsTo(Provider::class);
}
public function txodds_market()
{
return $this->belongsTo(TxoddsMarket::class);
}
}
+18
View File
@@ -0,0 +1,18 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class TxoddsMarket extends Model
{
protected $fillable = [
'market_id',
'shortname',
'name',
'soccer',
'ice_hockey',
'basketball',
'tennis',
];
}
+205
View File
@@ -0,0 +1,205 @@
<?php
namespace App\Models;
use Database\Factories\UserFactory;
use Filament\Auth\MultiFactor\App\Contracts\HasAppAuthentication;
use Filament\Auth\MultiFactor\App\Contracts\HasAppAuthenticationRecovery;
use Filament\Auth\MultiFactor\Email\Contracts\HasEmailAuthentication;
use Filament\Models\Contracts\FilamentUser;
use Filament\Panel;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Spatie\Permission\Traits\HasRoles;
class User extends Authenticatable implements FilamentUser, HasAppAuthentication, HasAppAuthenticationRecovery, HasEmailAuthentication, MustVerifyEmail
{
/** @use HasFactory<UserFactory> */
use HasFactory, HasRoles, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [
'gender',
'name',
'email',
'password',
'agb_akzeptiert',
'app_verified_at',
'client_id',
'sport_id',
'is_multiline_direct',
'all_only_none',
'partner_show',
'partner_compare',
'bookmaker_partner_differences',
'bookmaker_id',
'partner_bookmaker_id',
'provider_id',
];
protected static function newFactory(): Factory
{
return UserFactory::new();
}
/**
* The attributes that should be hidden for serialization.
*
* @var list<string>
*/
protected $hidden = [
'password',
'remember_token',
'app_authentication_secret',
'app_authentication_recovery_codes',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
'app_verified_at' => 'datetime',
'app_authentication_secret' => 'encrypted',
'app_authentication_recovery_codes' => 'encrypted:array',
'has_email_authentication' => 'boolean',
'is_multiline_direct' => 'boolean',
'partner_show' => 'boolean',
'partner_compare' => 'boolean',
'bookmaker_partner_differences' => 'boolean',
'starttime_differences' => 'boolean',
];
}
public function getAppAuthenticationSecret(): ?string
{
// This method should return the user's saved app authentication secret.
return $this->app_authentication_secret;
}
public function saveAppAuthenticationSecret(?string $secret): void
{
// This method should save the user's app authentication secret.
$this->app_authentication_secret = $secret;
$this->save();
}
public function getAppAuthenticationHolderName(): string
{
// In a user's authentication app, each account can be represented by a "holder name".
// If the user has multiple accounts in your app, it might be a good idea to use
// their email address as then they are still uniquely identifiable.
return $this->email;
}
/**
* @return ?array<string>
*/
public function getAppAuthenticationRecoveryCodes(): ?array
{
// This method should return the user's saved app authentication recovery codes.
return $this->app_authentication_recovery_codes;
}
/**
* @param array<string> | null $codes
*/
public function saveAppAuthenticationRecoveryCodes(?array $codes): void
{
// This method should save the user's app authentication recovery codes.
$this->app_authentication_recovery_codes = $codes;
$this->save();
}
public function hasEmailAuthentication(): bool
{
// This method should return true if the user has enabled email authentication.
return $this->has_email_authentication;
}
public function toggleEmailAuthentication(bool $condition): void
{
// This method should save whether or not the user has enabled email authentication.
$this->has_email_authentication = $condition;
$this->save();
}
public function canAccessPanel(Panel $panel): bool
{
return true;
}
public function canAccessAdminPanel(Panel $panel): bool
{
if ($panel->getId() === 'admin') {
return $this->hasVerifiedEmail();
}
return false;
}
public function provider()
{
return $this->belongsTo(Provider::class);
}
public function client()
{
return $this->belongsTo(Client::class);
}
public function bookmaker()
{
return $this->belongsTo(Bookmaker::class);
}
public function partnerbookmaker()
{
return $this->belongsTo(Bookmaker::class, 'partner_bookmaker_id', 'id');
}
public function sport()
{
return $this->belongsTo(Sport::class);
}
public function bettype_user()
{
return $this->hasMany(BettypeUser::class)->where('sport_id', auth()->user()->sport_id);
}
// Accessor
public function getUserBookmakerAttribute()
{
return $this->userBookmaker()->id ?? null;
}
public function userBookmaker()
{
return Bookmaker::where('id', auth()->user()->bookmaker_id)->select('id', 'name', 'icon', 'svg')->first();
}
public static function getUser()
{
return User::with('bookmaker')->find(auth()->user()->id);
}
}
+26
View File
@@ -0,0 +1,26 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class UserActivity extends Model
{
protected $fillable = [
'user_id',
'url',
'session_id',
'ip',
'country',
'location',
];
protected $casts = [
'created_at' => 'datetime',
];
public function user()
{
return $this->belongsTo(User::class);
}
}