Root Zanli
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
o5t6x7pgljbm
/
public_html
/
admin
/
app
/
Models
/
Filename :
TUITWallet.php
back
Copy
<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; /** * must be accessed and saved inside "SPWalletController" only. */ class TUITWallet extends Model { use SoftDeletes; protected $table = 'tuit_wallet'; protected $primaryKey = 'tuit_wallet_id'; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'user_id', 'wallet_uid', 'created_at', 'updated_at', 'deleted_at' ]; /** * The attributes that should be hidden for arrays. * * @var array */ protected $hidden = [ 'deleted_at' ]; public function getEarnedTuit(){ return SPWalletTransaction::where('tuit_wallet_id', $this->tuit_wallet_id) ->whereNull('deleted_at') ->sum('tuit_debit'); } }