filter finised
This commit is contained in:
1 parent
ff43f231f0
commit
f684d61a61
15 files changed
+376
-136
No files matched your search
@@ -28,6 +28,12 @@ class ColumnOdds extends Column
|
||||
|
||||
protected $client;
|
||||
|
||||
protected $filter_compare_bookmaker;
|
||||
|
||||
protected $filter_compare_mode;
|
||||
|
||||
protected $favorits = [];
|
||||
|
||||
public $compare;
|
||||
|
||||
public $partner;
|
||||
@@ -42,6 +48,18 @@ class ColumnOdds extends Column
|
||||
{
|
||||
$this->getData($record);
|
||||
|
||||
$this->setCompareDifferences();
|
||||
$this->favorits = ['h2w' => 0, 'a2w' => 0, 'h3w' => 0, 'd3w' => 0, 'a3w' => 0, 'home' => 0, 'away' => 0, 'margin' => 0];
|
||||
if ($this->filter_compare_bookmaker) {
|
||||
if ($this->filter_compare_mode == 'Favorit') {
|
||||
$this->setFavorits($record);
|
||||
} elseif ($this->filter_compare_mode == 'X') {
|
||||
$this->favorits = ['h2w' => 0, 'a2w' => 0, 'h3w' => 0, 'd3w' => 1, 'a3w' => 0, 'home' => 0, 'away' => 0, 'margin' => 0];
|
||||
} elseif ($this->filter_compare_mode == 'Margin') {
|
||||
$this->favorits = ['h2w' => 0, 'a2w' => 0, 'h3w' => 0, 'd3w' => 0, 'a3w' => 0, 'home' => 0, 'away' => 0, 'margin' => 1];
|
||||
}
|
||||
}
|
||||
|
||||
if (! $this->data) {
|
||||
$this->state = false;
|
||||
|
||||
@@ -74,10 +92,31 @@ class ColumnOdds extends Column
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setCompareDifferences()
|
||||
{
|
||||
$filters = $this->getTable()->getFilters();
|
||||
$filters = [$filters];
|
||||
foreach ($filters as $value) {
|
||||
$filter = $value['events']->getState();
|
||||
}
|
||||
if (isset($filter['filter_compare_differences'])) {
|
||||
$tmp = explode('-', $filter['filter_compare_differences']);
|
||||
$this->filter_compare_bookmaker = (int) $tmp[2];
|
||||
$this->filter_compare_mode = $tmp[0];
|
||||
} else {
|
||||
$this->filter_compare_bookmaker = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************
|
||||
* GETTER
|
||||
*******************************/
|
||||
|
||||
public function getCompareBookmaker()
|
||||
{
|
||||
return $this->filter_compare_bookmaker;
|
||||
}
|
||||
|
||||
public function getBettype()
|
||||
{
|
||||
return $this->bettype;
|
||||
@@ -132,6 +171,11 @@ class ColumnOdds extends Column
|
||||
return $this->min;
|
||||
}
|
||||
|
||||
public function getFavorits()
|
||||
{
|
||||
return $this->favorits;
|
||||
}
|
||||
|
||||
public function getData($record)
|
||||
{
|
||||
$this->client = null;
|
||||
@@ -274,6 +318,42 @@ class ColumnOdds extends Column
|
||||
* SETTER
|
||||
*******************************/
|
||||
|
||||
public function setFavorits($record)
|
||||
{
|
||||
if ($this->filter_compare_bookmaker) {
|
||||
switch ($this->bettype) {
|
||||
case 'odds_2ways':
|
||||
$tmp = $record->odds_2ways->where('bookmaker_id', $this->filter_compare_bookmaker)->first();
|
||||
if ($tmp->h2w < $tmp->a2w) {
|
||||
$this->favorits['h2w'] = 1;
|
||||
} else {
|
||||
$this->favorits['a2w'] = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'odds_3ways':
|
||||
$tmp = $record->odds_3ways->where('bookmaker_id', $this->filter_compare_bookmaker)->first();
|
||||
if ($tmp->h3w < $tmp->d3w && $tmp->h3w < $tmp->a3w) {
|
||||
$this->favorits['h3w'] = 1;
|
||||
} elseif ($tmp->d3w < $tmp->a3w) {
|
||||
$this->favorits['d3w'] = 1;
|
||||
} else {
|
||||
$this->favorits['a3w'] = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'odds_points':
|
||||
$tmp = $record->odds_points->where('bookmaker_id', $this->filter_compare_bookmaker)->first();
|
||||
if ($tmp->home < $tmp->away) {
|
||||
$this->favorits['home'] = 1;
|
||||
} else {
|
||||
$this->favorits['away'] = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function setMinMax($record)
|
||||
{
|
||||
switch ($this->bettype) {
|
||||
|
||||
Reference in new issue
Block a user