'int', 'shopping_order_id' => 'int', 'status' => 'int', 'paid' => 'bool', ]; protected $fillable = [ 'user_abo_id', 'user_id', 'shopping_order_id', 'status', 'error_message', 'paid', ]; public static $statusTypes = [ 0 => 'abo_new', 1 => 'abo_new', 2 => 'abo_okay', 3 => 'abo_hold', 4 => 'abo_cancel', 5 => 'abo_finish', 6 => 'abo_inactive', 7 => 'abo_grace', 8 => 'abo_extern_done', ]; public static $statusColors = [ 0 => 'success', 1 => 'success', 2 => 'secondary', 3 => 'warning', 4 => 'danger', 5 => 'info', 6 => 'warning', 7 => 'danger', 8 => 'success', ]; public function shopping_order() { return $this->belongsTo(ShoppingOrder::class); } public function user_abo() { return $this->belongsTo(UserAbo::class); } public function getStatusFormated() { return ''.$this->getStatusType().''; } public function getStatusType() { return isset(self::$statusTypes[$this->status]) ? __('abo.'.self::$statusTypes[$this->status]) : ''; } public function getStatusColor() { return isset(self::$statusColors[$this->status]) ? self::$statusColors[$this->status] : 'default'; } }