20-02-2026
This commit is contained in:
parent
a8b395e20d
commit
a00c42e770
252 changed files with 28785 additions and 8907 deletions
|
|
@ -25,8 +25,8 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @property Carbon|null $updated_at
|
||||
* @property UserCredit|null $user_credit
|
||||
* @property User $user
|
||||
* @package App\Models
|
||||
* @property int|null $user_business_id
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditItem newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditItem newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditItem query()
|
||||
|
|
@ -40,103 +40,109 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditItem whereUserBusinessId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditItem whereUserCreditId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditItem whereUserId($value)
|
||||
*
|
||||
* @property int|null $from_month
|
||||
* @property int|null $from_year
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditItem whereFromMonth($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditItem whereFromYear($value)
|
||||
*
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class UserCreditItem extends Model
|
||||
{
|
||||
public static $statusTypes = [
|
||||
1 => 'commission_shop',
|
||||
2 => 'commission_payline',
|
||||
3 => 'credit_added',
|
||||
4 => 'commission',
|
||||
5 => 'commission_growth_bonus',
|
||||
|
||||
|
||||
public static $statusTypes = [
|
||||
1 => 'commission_shop',
|
||||
2 => 'commission_payline',
|
||||
3 => 'credit_added',
|
||||
4 => 'commission',
|
||||
5 => 'commission_growth_bonus',
|
||||
|
||||
];
|
||||
|
||||
public static $statusColors = [
|
||||
0 => 'warning',
|
||||
1 => 'success',
|
||||
2 => 'secondary',
|
||||
3 => 'warning',
|
||||
4 => 'info',
|
||||
5 => 'secondary',
|
||||
10 => 'danger',
|
||||
];
|
||||
|
||||
public static $statusColors = [
|
||||
0 => 'warning',
|
||||
1 => 'success',
|
||||
2 => 'secondary',
|
||||
3 => 'warning',
|
||||
4 => 'info',
|
||||
5 => 'secondary',
|
||||
10 => 'danger',
|
||||
];
|
||||
|
||||
protected $table = 'user_credit_items';
|
||||
protected $table = 'user_credit_items';
|
||||
|
||||
protected $casts = [
|
||||
'user_id' => 'int',
|
||||
'user_credit_id' => 'int',
|
||||
'user_business_id' => 'int',
|
||||
'credit' => 'float',
|
||||
'status' => 'int',
|
||||
'from_month' => 'int',
|
||||
'from_year' => 'int',
|
||||
'paid' => 'bool'
|
||||
];
|
||||
protected $casts = [
|
||||
'user_id' => 'int',
|
||||
'user_credit_id' => 'int',
|
||||
'user_business_id' => 'int',
|
||||
'credit' => 'float',
|
||||
'status' => 'int',
|
||||
'from_month' => 'int',
|
||||
'from_year' => 'int',
|
||||
'paid' => 'bool',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'user_credit_id',
|
||||
'user_business_id',
|
||||
'credit',
|
||||
'message',
|
||||
'status',
|
||||
'from_month',
|
||||
'from_year',
|
||||
'paid'
|
||||
];
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'user_credit_id',
|
||||
'user_business_id',
|
||||
'credit',
|
||||
'message',
|
||||
'status',
|
||||
'from_month',
|
||||
'from_year',
|
||||
'paid',
|
||||
];
|
||||
|
||||
public function user_credit()
|
||||
{
|
||||
return $this->belongsTo(UserCredit::class);
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
|
||||
public function deleteTime(){
|
||||
$time = '+100 min';
|
||||
if(Carbon::parse($this->created_at)->modify($time)->gt(Carbon::now())){
|
||||
return Carbon::now()->diffInMinutes(Carbon::parse($this->created_at)->modify($time));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getStatusType(){
|
||||
return isset(self::$statusTypes[$this->status]) ? __('payment.'.self::$statusTypes[$this->status]) : "";
|
||||
public function user_credit()
|
||||
{
|
||||
return $this->belongsTo(UserCredit::class);
|
||||
}
|
||||
|
||||
public function getStatusColor(){
|
||||
return isset(self::$statusColors[$this->status]) ? self::$statusColors[$this->status] : "default";
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function getTransMessage(){
|
||||
$ret = "";
|
||||
if(strpos($this->message, '#')){
|
||||
$em = explode("#", $this->message);
|
||||
if(isset($em[0])){ //Provision
|
||||
$ret .= trans($em[0])." ";
|
||||
}
|
||||
if(isset($em[1])){ //month
|
||||
$ret .= HTMLHelper::getMonth($em[1])." ";
|
||||
}
|
||||
if(isset($em[2])){ //year
|
||||
$ret .= $em[2];
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
public function deleteTime()
|
||||
{
|
||||
$time = '+100 min';
|
||||
if (Carbon::parse($this->created_at)->modify($time)->gt(Carbon::now())) {
|
||||
return Carbon::now()->diffInMinutes(Carbon::parse($this->created_at)->modify($time));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getStatusType()
|
||||
{
|
||||
return isset(self::$statusTypes[$this->status]) ? __('payment.'.self::$statusTypes[$this->status]) : '';
|
||||
}
|
||||
|
||||
public function getStatusColor()
|
||||
{
|
||||
return isset(self::$statusColors[$this->status]) ? self::$statusColors[$this->status] : 'default';
|
||||
}
|
||||
|
||||
public function getTransMessage()
|
||||
{
|
||||
$ret = '';
|
||||
if (strpos($this->message, '#')) {
|
||||
$em = explode('#', $this->message);
|
||||
if (isset($em[0])) { // Provision
|
||||
$ret .= trans($em[0]).' ';
|
||||
}
|
||||
if (isset($em[1])) { // month
|
||||
$ret .= HTMLHelper::getMonth($em[1]).' ';
|
||||
}
|
||||
if (isset($em[2])) { // year
|
||||
$ret .= $em[2];
|
||||
}
|
||||
} else {
|
||||
$ret = $this->message;
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue