Edit File: Wallet.php
<?php namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\MorphTo; class Wallet extends Model { use HasFactory; protected $fillable = [ 'walletable_id', 'walletable_type', 'balance', 'available_balance', 'debt_balance', ]; /** * Get the parent walletable model. * @return MorphTo */ public function walletable(): MorphTo { return $this->morphTo(); } /** * Get the wallet transactions. * @return HasMany */ public function transactions(): HasMany { return $this->hasMany(WalletTransaction::class, 'wallet_id', 'id'); } }
Back to File Manager