06 2022
This commit is contained in:
parent
9b0b5feb7e
commit
7a040c3e19
106 changed files with 4074 additions and 1349 deletions
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Services\Util;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\UserLevel as ModelsUserLevel;
|
||||
|
||||
/**
|
||||
* App\Models\UserLevel
|
||||
|
|
@ -13,12 +15,14 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @property float|null $margin
|
||||
* @property int|null $pos
|
||||
* @property int $active
|
||||
* @property int $default
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel whereActive($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel whereDefault($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel whereMargin($value)
|
||||
|
|
@ -27,6 +31,29 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel whereTransName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
* @property int|null $next_id
|
||||
* @property int|null $margin_shop
|
||||
* @property int|null $qual_kp
|
||||
* @property int|null $qual_tp
|
||||
* @property string|null $growth_bonus
|
||||
* @property int|null $pr_line_1
|
||||
* @property int|null $pr_line_2
|
||||
* @property int|null $pr_line_3
|
||||
* @property int|null $pr_line_4
|
||||
* @property int|null $pr_line_5
|
||||
* @property int|null $pr_line_6
|
||||
* @property-read UserLevel|null $next_user_level
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserLevel whereGrowthBonus($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserLevel whereMarginShop($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserLevel whereNextId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserLevel wherePrLine1($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserLevel wherePrLine2($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserLevel wherePrLine3($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserLevel wherePrLine4($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserLevel wherePrLine5($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserLevel wherePrLine6($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserLevel whereQualKp($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserLevel whereQualTp($value)
|
||||
*/
|
||||
class UserLevel extends Model
|
||||
{
|
||||
|
|
@ -35,41 +62,40 @@ class UserLevel extends Model
|
|||
protected $casts = ['trans_name' => 'array'];
|
||||
|
||||
protected $fillable = [
|
||||
'name', 'margin', 'pos', 'active',
|
||||
'next_id', 'name', 'margin', 'margin_shop', 'qual_kp', 'qual_tp', 'growth_bonus', 'pr_line_1', 'pr_line_2', 'pr_line_3', 'pr_line_4', 'pr_line_5', 'pr_line_6', 'pos', 'active', 'default',
|
||||
];
|
||||
|
||||
|
||||
/* public function childrens()
|
||||
public function next_user_level()
|
||||
{
|
||||
return $this->hasMany('App\Models\Attribute', 'parent_id', 'id');
|
||||
return $this->belongsTo('App\Models\UserLevel', 'next_id', 'id');
|
||||
}
|
||||
|
||||
public function getNextUserLevels(){
|
||||
//$ret = [0=>'Keinen'];
|
||||
$ret = UserLevel::where('active', true)->where('id', '!=', $this->id)->orderBy('pos', 'asc')->get()->pluck('name', 'id')->toArray();
|
||||
return array_add($ret, 0, '-> Keinen Karriere Level');
|
||||
}
|
||||
*/
|
||||
|
||||
public function setPosAttribute($value){
|
||||
$this->attributes['pos'] = is_numeric($value) ? $value : null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function _format_number($value){
|
||||
return preg_replace("/[^0-9,]/", "", $value);
|
||||
public function setGrowthBonusAttribute($value)
|
||||
{
|
||||
$this->attributes['growth_bonus'] = $value !== null ? Util::reFormatNumber($value) : null;
|
||||
}
|
||||
|
||||
public function setMarginAttribute( $value ) {
|
||||
$value = $this->_format_number($value);
|
||||
$this->attributes['margin'] = floatval(str_replace(',', '.', $value));
|
||||
public function getFormattedGrowthBonus()
|
||||
{
|
||||
return isset($this->attributes['growth_bonus']) ? Util::formatNumber($this->attributes['growth_bonus'],1) : "";
|
||||
}
|
||||
|
||||
public function getFormattedMargin()
|
||||
{
|
||||
if(!isset($this->attributes['margin'])){
|
||||
return "";
|
||||
}
|
||||
if(\App::getLocale() === "en"){
|
||||
return number_format($this->attributes['margin'], 2, '.', ',');
|
||||
}
|
||||
return number_format($this->attributes['margin'], 2, ',', '.');
|
||||
return isset($this->attributes['margin']) ? $this->attributes['margin'] : "";
|
||||
}
|
||||
|
||||
|
||||
public function getLang($key)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue