| Current Path : /home/users/unlimited/www/sigmaerp.codeskitter.site/app/Models/ |
| Current File : /home/users/unlimited/www/sigmaerp.codeskitter.site/app/Models/CashAdjustment.php |
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\MorphMany;
use Illuminate\Database\Eloquent\Model;
use App\Models\PaymentTransaction;
class CashAdjustment extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'adjustment_type',
'adjustment_date',
'payment_type_id',
'amount',
'note',
];
/**
* Insert & update User Id's
* */
protected static function boot()
{
parent::boot();
static::creating(function ($model) {
$model->created_by = auth()->id();
$model->updated_by = auth()->id();
});
static::updating(function ($model) {
$model->updated_by = auth()->id();
});
}
/**
* Define the relationship between Expense Payment Transaction & Expense table.
*
* @return MorphMany
*/
public function paymentTransaction(): MorphMany
{
return $this->morphMany(PaymentTransaction::class, 'transaction');
}
public function getTableCode()
{
return null;
}
}