Edit File: WalletTransaction.php
<?php namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\MorphTo; class WalletTransaction extends Model { use HasFactory; protected $fillable = [ 'wallet_id', 'type', 'amount', 'transactionable_id', 'transactionable_type', ]; /** * Get the type text of the wallet transaction. * @return string */ public function getTypeTextAttribute($value) { return __('admin.wallet_type_' . $this->attributes['type']); } /** * Get the wallet of the wallet transaction. * @return BelongsTo */ public function wallet(): BelongsTo { return $this->belongsTo(Wallet::class, 'wallet_id', 'id'); } /** * Get the transactionable model of the wallet transaction. * @return MorphTo */ public function transactionable(): MorphTo { return $this->morphTo(); } }
Back to File Manager