wip del err
This commit is contained in:
1 parent
812736ca9a
commit
9bcd4432c6
1210 files changed
-220941
No files matched your search
@@ -1,46 +0,0 @@
|
||||
<?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');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user