Membership
This commit is contained in:
parent
37cb2b06c7
commit
21abafb8db
51 changed files with 1549 additions and 493 deletions
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