User Order all Margins / Checkout
This commit is contained in:
parent
a96d7d5c77
commit
224bf9e951
92 changed files with 3551 additions and 561 deletions
90
app/Models/UserLevelMargin.php
Normal file
90
app/Models/UserLevelMargin.php
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Services\Util;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class UserLevelMargin
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $user_level_id
|
||||
* @property float|null $price_from
|
||||
* @property float|null $trading_margin
|
||||
* @property float|null $commission
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property UserLevel $user_level
|
||||
* @package App\Models
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserLevelMargin newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserLevelMargin newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserLevelMargin query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserLevelMargin whereCommission($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserLevelMargin whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserLevelMargin whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserLevelMargin wherePriceFrom($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserLevelMargin whereTradingMargin($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserLevelMargin whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserLevelMargin whereUserLevelId($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class UserLevelMargin extends Model
|
||||
{
|
||||
protected $table = 'user_level_margins';
|
||||
|
||||
protected $casts = [
|
||||
'user_level_id' => 'int',
|
||||
'price_from' => 'float',
|
||||
'trading_margin' => 'float',
|
||||
'commission' => 'float'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'user_level_id',
|
||||
'price_from',
|
||||
'trading_margin',
|
||||
'commission'
|
||||
];
|
||||
|
||||
public function user_level()
|
||||
{
|
||||
return $this->belongsTo(UserLevel::class);
|
||||
}
|
||||
|
||||
|
||||
public function setPriceFromAttribute($value)
|
||||
{
|
||||
$this->attributes['price_from'] = $value ? Util::reFormatNumber($value) : 0;
|
||||
}
|
||||
|
||||
public function getFormattedPriceFrom()
|
||||
{
|
||||
return isset($this->attributes['price_from']) ? Util::formatNumber($this->attributes['price_from']) : "";
|
||||
}
|
||||
|
||||
public function setTradingMarginAttribute($value)
|
||||
{
|
||||
$this->attributes['trading_margin'] = $value ? Util::reFormatNumber($value) : 0;
|
||||
}
|
||||
|
||||
public function getFormattedTradingMargin()
|
||||
{
|
||||
return isset($this->attributes['trading_margin']) ? Util::formatNumber($this->attributes['trading_margin']) : "";
|
||||
}
|
||||
|
||||
public function setCommissionAttribute($value)
|
||||
{
|
||||
$this->attributes['commission'] = $value ? Util::reFormatNumber($value) : 0;
|
||||
}
|
||||
|
||||
public function getFormattedCommission()
|
||||
{
|
||||
return isset($this->attributes['commission']) ? Util::formatNumber($this->attributes['commission']) : "";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue