Membership
This commit is contained in:
parent
37cb2b06c7
commit
21abafb8db
51 changed files with 1549 additions and 493 deletions
|
|
@ -12,7 +12,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||
|
||||
/**
|
||||
* Class File
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $user_id
|
||||
* @property string $filename
|
||||
|
|
@ -23,10 +23,24 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @property int $size
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
*
|
||||
* @property User $user
|
||||
*
|
||||
* @package App\Models
|
||||
* @property string $identifier
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\File newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\File newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\File query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\File whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\File whereDir($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\File whereExt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\File whereFilename($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\File whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\File whereIdentifier($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\File whereMine($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\File whereOriginalName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\File whereSize($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\File whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\File whereUserId($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class File extends Model
|
||||
{
|
||||
|
|
|
|||
|
|
@ -90,11 +90,25 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\ProductImage[] $imagesActive
|
||||
* @property-read int|null $images_active_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Product wherePoints($value)
|
||||
* @property string|null $identifier
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Product whereIdentifier($value)
|
||||
* @property int|null $upgrade_to_id
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Product whereUpgradeToId($value)
|
||||
*/
|
||||
class Product extends Model
|
||||
{
|
||||
|
||||
/*identifiers
|
||||
show_upgrade # in membership payment can upgrade this package to show order
|
||||
show_order # in membership payment show always
|
||||
upgrade # need upgrade_to_id set user->payment_order_id to the package in the payment api
|
||||
*/
|
||||
|
||||
protected $identifiers_types = [
|
||||
'show_upgrade' => 'Kann gepdatet werden',
|
||||
'show_order' => 'Wird immer als Option angezeigt',
|
||||
'upgrade' => 'Produktupgrade zu upgrade_to_id',
|
||||
];
|
||||
protected $table = 'products';
|
||||
|
||||
protected $casts = [
|
||||
|
|
@ -134,7 +148,8 @@ class Product extends Model
|
|||
'active',
|
||||
'show_at',
|
||||
'identifier',
|
||||
'action'
|
||||
'action',
|
||||
'upgrade_to_id'
|
||||
];
|
||||
|
||||
public $showATs = [
|
||||
|
|
@ -148,6 +163,7 @@ class Product extends Model
|
|||
public $actions = [
|
||||
0 => 'payment_for_account',
|
||||
1 => 'payment_for_shop',
|
||||
2 => 'payment_for_shop_upgrade',
|
||||
];
|
||||
|
||||
public function sluggable()
|
||||
|
|
|
|||
|
|
@ -28,14 +28,24 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingInstance whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingInstance whereUserShopId($value)
|
||||
* @mixin \Eloquent
|
||||
* @property int|null $payment
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingInstance wherePayment($value)
|
||||
*/
|
||||
class ShoppingInstance extends Model
|
||||
{
|
||||
|
||||
public $paymentTypes = [
|
||||
1 => 'User Shop',
|
||||
2 => 'Berater Shop',
|
||||
3 => 'Berater Membership',
|
||||
4 => 'Berater Wizard',
|
||||
];
|
||||
|
||||
protected $table = 'shopping_instances';
|
||||
|
||||
|
||||
protected $fillable = [
|
||||
'identifier', 'user_shop_id', 'auth_user_id', 'subdomain', 'country_id'
|
||||
'identifier', 'user_shop_id', 'auth_user_id', 'payment', 'subdomain', 'country_id'
|
||||
];
|
||||
|
||||
public function user_shop()
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereUserShopId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereWeight($value)
|
||||
* @mixin \Eloquent
|
||||
* @property int|null $payment_for
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder wherePaymentFor($value)
|
||||
*/
|
||||
class ShoppingOrder extends Model
|
||||
{
|
||||
|
|
@ -104,6 +106,11 @@ class ShoppingOrder extends Model
|
|||
return $this->belongsTo('App\User','auth_user_id');
|
||||
}
|
||||
|
||||
public function user_history()
|
||||
{
|
||||
return $this->hasOne('App\Models\UserHistory','shopping_order_id')->latest();
|
||||
}
|
||||
|
||||
|
||||
public function shopping_order_items(){
|
||||
return $this->hasMany('App\Models\ShoppingOrderItem', 'shopping_order_id');
|
||||
|
|
@ -113,6 +120,14 @@ class ShoppingOrder extends Model
|
|||
return $this->hasMany('App\Models\ShoppingPayment', 'shopping_order_id');
|
||||
}
|
||||
|
||||
public function setUserHistoryValue($values = []){
|
||||
if($user_history = $this->user_history){
|
||||
foreach ($values as $key=>$val){
|
||||
$user_history->{$key} = $val;
|
||||
}
|
||||
$user_history->save();
|
||||
}
|
||||
}
|
||||
|
||||
public function _format_number($value)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -73,6 +73,8 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @property-read \App\Models\ShoppingOrder $shopping_order
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\ShoppingOrder[] $shopping_orders
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingUser whereOrders($value)
|
||||
* @property int|null $abo_options
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingUser whereAboOptions($value)
|
||||
*/
|
||||
class ShoppingUser extends Model
|
||||
{
|
||||
|
|
|
|||
|
|
@ -113,6 +113,8 @@ use Carbon\Carbon;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount whereMNotes($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount whereMSalutation($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount whereTaxableSales($value)
|
||||
* @property array|null $payment_data
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount wherePaymentData($value)
|
||||
*/
|
||||
class UserAccount extends Model
|
||||
{
|
||||
|
|
|
|||
125
app/Models/UserHistory.php
Normal file
125
app/Models/UserHistory.php
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\User;
|
||||
|
||||
/**
|
||||
* Class UserHistory
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $user_id
|
||||
* @property int $shopping_order_id
|
||||
* @property int $product_id
|
||||
* @property string $action
|
||||
* @property int $referenz
|
||||
* @property int $status
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
* @property Product $product
|
||||
* @property ShoppingOrder $shopping_order
|
||||
* @property User $user
|
||||
* @package App\Models
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserHistory newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserHistory newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserHistory query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserHistory whereAction($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserHistory whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserHistory whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserHistory whereProductId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserHistory whereReferenz($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserHistory whereShoppingOrderId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserHistory whereStatus($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserHistory whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserHistory whereUserId($value)
|
||||
* @mixin \Eloquent
|
||||
* @property string|null $identifier
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserHistory whereIdentifier($value)
|
||||
*/
|
||||
class UserHistory extends Model
|
||||
{
|
||||
protected $table = 'user_histories';
|
||||
|
||||
protected $status_types = [
|
||||
1 => 'store_payment',
|
||||
2 => 'checkout_payment',
|
||||
3 => 'payment_error',
|
||||
4 => 'payment_redirect',
|
||||
5 => 'payment_approved',
|
||||
6 => 'txaction_failed',
|
||||
7 => 'txaction_appointed',
|
||||
8 => 'txaction_paid',
|
||||
9 => 'success_payment',
|
||||
10 => 'success',
|
||||
21 => 'payment_not_found',
|
||||
22 => 'checkout_cancel',
|
||||
23 => 'checkout_error',
|
||||
50 => 'delete_membership'
|
||||
];
|
||||
protected $status_colors = [
|
||||
1 => 'warning',
|
||||
2 => 'warning',
|
||||
3 => 'danger',
|
||||
4 => 'warning',
|
||||
5 => 'success',
|
||||
6 => 'danger',
|
||||
7 => 'warning',
|
||||
8 => 'success',
|
||||
9 => 'success',
|
||||
10 => 'success',
|
||||
21 => 'danger',
|
||||
22 => 'danger',
|
||||
23 => 'danger',
|
||||
];
|
||||
protected $casts = [
|
||||
'user_id' => 'int',
|
||||
'shopping_order_id' => 'int',
|
||||
'product_id' => 'int',
|
||||
'referenz' => 'int',
|
||||
'status' => 'int'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'shopping_order_id',
|
||||
'product_id',
|
||||
'action',
|
||||
'referenz',
|
||||
'identifier',
|
||||
'abo_options',
|
||||
'status'
|
||||
];
|
||||
|
||||
public function product()
|
||||
{
|
||||
return $this->belongsTo(Product::class);
|
||||
}
|
||||
|
||||
public function shopping_order()
|
||||
{
|
||||
return $this->belongsTo(ShoppingOrder::class);
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function getStatusType(){
|
||||
if(isset($this->status_types[$this->status])){
|
||||
return $this->status_types[$this->status];
|
||||
}
|
||||
}
|
||||
public function getStatusColor(){
|
||||
if(isset($this->status_colors[$this->status])){
|
||||
return $this->status_colors[$this->status];
|
||||
}
|
||||
return 'default';
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue