⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.1
Server IP:
185.238.29.86
Server:
Linux server2 6.8.12-6-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-6 (2024-12-19T19:05Z) x86_64
Server Software:
nginx/1.18.0
PHP Version:
8.1.31
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
var
/
www
/
work
/
modules
/
User
/
Models
/
Wallet
/
View File Name :
Transaction.php
<?php namespace Modules\User\Models\Wallet; use App\BaseModel; use App\User; use Illuminate\Database\Eloquent\SoftDeletes; use Modules\Booking\Models\Payment; class Transaction extends BaseModel { use SoftDeletes; protected $table = 'credit_transactions'; protected $casts = [ 'meta' => 'array' ]; public function payment(){ return $this->belongsTo(Payment::class,'payment_id')->withDefault(); } public function author(){ return $this->belongsTo(User::class, 'user_id')->withDefault(); } public function getStatusNameAttribute(){ if($this->confirmed){ return __("Confirmed"); } if(!$this->payment_id || !$this->payment){ return __("Pending"); } return $this->payment->status_name; } public function getStatusClassAttribute(){ if($this->confirmed){ return 'success'; } if($this->payment_id && $this->payment){ switch ($this->payment->status){ case "processing": return 'warning'; break; } } return 'warning'; } public function confirm() { if ($this->author and !$this->status != 'confirmed') { $this->author->credit_balance += $this->amount; $this->author->save(); } $this->status = 'confirmed'; $this->save(); } }