This commit is contained in:
gholak tala
2026-01-24 14:03:11 +00:00
parent 7dcd83715a
commit eb26afbcb3
224 changed files with 32652 additions and 0 deletions
+55
View File
@@ -0,0 +1,55 @@
<?php
namespace Rooyesh\Wallet\models;
use App\Models\Selector;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Transaction extends Model
{
use HasFactory,Selector;
protected $guarded=['hash'];
protected $casts = [
'active'=>'boolean',
'number'=>'float',
];
static $TYPES = [
1 => 'خرید طلا',
2 => 'فروش طلا',
3 => 'واریز ریالی',
7 => 'واریز طلایی',
4 => 'برداشت ریالی',
5 => 'واریز',
6 => 'برداشت',
8 => ' پاداش بابت معرفی',
9 => 'سود زیر مجموعه',
];
public function customer()
{
return $this->belongsTo('App\Models\Customer')->select(['id','name']);
}
public function wallet()
{
return $this->belongsTo(Wallet::class, 'wallet', 'id'); // 'wallet' is the foreign key in transactions table
}
public function fund()
{
return $this->belongsTo('App\Models\Fund','fund_id')->select(['id','title']);
}
public function product()
{
return $this->belongsTo('App\Models\Product','product_id')->select(['id','title','group_type']);
}
public function order()
{
return $this->belongsTo('App\Models\Order','order_id');
}
public function withdraw()
{
return $this->belongsTo('App\Models\Withdraw','withdraw_id');
}
}
+13
View File
@@ -0,0 +1,13 @@
<?php
namespace Rooyesh\Wallet\models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class TransactionMeta extends Model
{
use HasFactory;
protected $guarded=[];
}
+27
View File
@@ -0,0 +1,27 @@
<?php
namespace Rooyesh\Wallet\models;
use App\Models\Selector;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Wallet extends Model
{
protected $guarded=['hash'];
use Selector;
use HasFactory;
public function customer()
{
return $this->belongsTo('App\Models\Customer','owner')->select(['id','name']);
}
public function fund()
{
return $this->belongsTo('App\Models\Fund','fund_id')->select(['id','title']);
}
public function Product()
{
return $this->belongsTo('App\Models\Product','product_id');
}
}